+ Reply to Thread
Results 1 to 16 of 16

export a range and save as .jpg

  1. #1
    Registered User
    Join Date
    04-13-2010
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    export a range and save as .jpg

    Can anybody help me?

    I need a macro that will take a range of cells (A1:F20) and export them and SAVE AS a .jpg file.
    The file should save to a designated directory (C:\Backups\) and the filename should be "counts" + the current date.

    example: C:\Backups\counts 5-3-2010

    Any ideas?
    Last edited by skooter2k5; 05-03-2010 at 02:15 PM.

  2. #2
    Registered User
    Join Date
    04-13-2010
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: export a range and save as .jpg?????

    bump. waiting for a reply

  3. #3
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: export a range and save as .jpg?????

    See this link
    http://www.mrexcel.com/forum/showthread.php?t=233108

    Hope it helps...
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg?????

    Made some tweaks to existing code, but haven't tested - you run the JPGSnapshot routine.
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Unhappy Re: export a range and save as .jpg?????

    Hi I need to achieve the same objective but have tried the following and it doesn't work

    Can anyone help please

    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg?????

    Perhaps you could give us a little more to go on?

  7. #7
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg?????

    Hi,

    I'm looking to export a picture of a range of cells

    In the attached example I would like an exported picture of the range c4..e6 only

    Thanks
    Attached Files Attached Files

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg

    I mean, what specifically is the issue with the code?

  9. #9
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg

    Hi,

    When run, it creates a new VBAProject (Sheetn) where n is an increasing value but doesn't generate an output picture

    Your help would be really appreciated

    Thanks

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg

    Try this version:
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg

    Hi,

    Thanks for helping me with this challenge

    I've tried the new code and get "run time error 1004 - application-defined or object-defined error"

    Thanks

  12. #12
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg

    Hi again,

    Found the problem - it was an incorrect folder destination I'd put in

    It now works brilliantly, thank you

    Please would you let me know how I can change it to take a fixed range?

    Thanks very much

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg

    Change this line in the JPG_Snapshot routine:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    for example.

  14. #14
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg

    Hi,

    Again, fantastic this works perfectly

    Is it possible to turn the grid off for the picture only?

    Thanks

  15. #15
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,982

    Re: export a range and save as .jpg

    Turn it off at the start and back on at the end:
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: export a range and save as .jpg

    Thank you very much

    I'm absolutely delighted with the result and very grateful for your support

    Best wishes

+ 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