+ Reply to Thread
Results 1 to 10 of 10

Export range as JPG

  1. #1
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13

    Export range as JPG

    Hi all,
    Using and adapting some from http://www.mvps.org/dmcritchie/excel/xl2gif.htm and http://www.ozgrid.com/forum/showthread.php?t=88851 I succeeded in exporting name ranges as jpg's.
    However, I still have a 'problem' : I would like to set the dimensions of the jpg in code.
    Is there any help on the way ?
    Thanks
    Eddie

    An additional question on this subject.
    The ranges I am exported have a green background (for publishing on a website). When I do the export in Excel XP, everything looks fine (except for the automatic sizing), but when I use Excel 2007 there is a white border around the jpg.
    Any ideas about this.
    Thanks again.
    Eddie
    My code :
    Please Login or Register  to view this content.
    Last edited by strep21; 10-26-2008 at 08:42 AM.

  2. #2
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13

    Export range as jpg Excel2007 vs Excel2002

    Bump.

    I can imagine this subject is not so common, but I'd like to try again
    For the first part of my question (the redimentioning) I found a solution.

    I'll rephrase the second part, just in case I wasn't clear
    I export a range (well, up to 44 ranges in fact), with a green background, to jpg.
    In Excel XP this works without problems.
    In Excel 2007 there is a white border around the (green) jpg.
    Has anybody an idea why ? And more important, how to avoid that border ?

    Eddie

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Can you post code or link to the solution of resizing?

    The border is produced by the chart export method and is difficult to remove.

    If you can work with bmp image then the PastePicture workbook at Stephen Bullen's site should remove the border.
    http://www.oaltd.co.uk/Excel/Default.htm
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13
    Thanks for responding Andy.
    The trick for resizing lies in first copying the range into a new workbook (normal sheet, not a graphic), resize, copy again and pasting in another new workbook as bmp. Followed by the 'normal' export as jpg.
    My present code :
    Please Login or Register  to view this content.
    I had a (quick) look at the PastePicture.zip you mentioned, but I don't immediately see how to use or incorporate it (I'm totally ignorant when it comes to API calls, and have no formal programming background).
    But, stubborn as I am, I will look at it again

    Eddie

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    So you increase the thing being turned in to an image rather than manipulate the image afterwards.

    If you need more help post back.

  6. #6
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13
    Andy,
    The file you mentioned, doesn't work for me in Excel 2007.
    Nothing seems to get copied to the clipboard, I can't see how that is supposed to be done/corrected.
    Btw, a bmp format as final result wouldn't be acceptable, files would be to big.
    I hope I won't have to live with those borders around the pics on my website
    I'm not sure what kind of help to ask for, I suppose exporting a range to jgp is not a very common subject, even less in Excel 2007.
    Not that I'm giving up
    Eddie

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    I just added this routine to a code module in that project.
    It will export the current selection as a emf image. It will do jpg but the image is large in view if not size.

    Please Login or Register  to view this content.
    Most people do copypicture/paste or screen grabs. It's only when you are automating this task or doing it repeatedly that code is needed.

  8. #8
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13

    I give up (hate to do that)

    Andy,
    I went through the code and the ref you sent me, but I can't seem to get rid of that white border around my exported (wmf in this case) picture.

    If you, or anyone else is interested, I attached a my simplified version in both 97-2003 and 2007 format.

    Since I'm not familiar at all with the use of API calls, I'll stick to my original code. At least I understand that ( I think :D).
    Thanks again for your help.

    Eddie
    Attached Files Attached Files

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    I just used the xlsm version and created this image. I see no white border.
    I added the border to the cells so the boundary is more obvious.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-17-2006
    Location
    Belgium
    Posts
    13
    Andy,
    This is almost becoming funny :
    - if I export a pic and look at it with e.g. Paint, there is a white border
    - if I use the pic in Frontpage, there is a white border
    - if I insert the pic in an excel sheet (like in your example). there is no border
    Totally confusing to me !
    Eddie

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1