+ Reply to Thread
Results 1 to 7 of 7

Export Image Issues

  1. #1
    Registered User
    Join Date
    07-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    8

    Export Image Issues

    All-

    I am using the below code to export an image of a range. It works perfectly, except for the fact that it comes out as a picture of my range over top of a chart of the data in the range.

    How do I do get this to only export the picture of the range?

    Any help would be greatly appreciated!


    Code:

    Sub RangePic()

    Worksheets("NewRepScoring").Range("A1:Q17").CopyPicture xlScreen, xlBitmap

    Application.DisplayAlerts = False
    Set oCht = Charts.Add
    With oCht
    .Paste
    .Export Filename:="\\portal\DavWWWRoot\cwie\sales\business\QA%20Pages\RepDashboard.png", Filtername:="PNG"
    .Delete
    End With
    End Sub

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Export Image Issues

    I guess you got the idea from like this: http://www.jpsoftwaretech.com/export...re-file-redux/

    Try adding a sheet via code, do your thing, and remove the sheet.

    If you don't mind BMP files, with a reference to the Microsoft Forms 2.0 Object Library.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Export Image Issues

    Thanks for your help! However, I'm not sure I follow completely.

    I tried your code and it buts a line break between the const and the beginning of the Sub. then gives me a Run-time error '424' and highlights the 'SavePicture' line.

    Is there something I'm missing?

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Export Image Issues

    Did you add the reference to the Forms object from VBE's Tool's menu?
    reference to the Microsoft Forms 2.0 Object Library

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Export Image Issues

    Maybe try something like this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  6. #6
    Registered User
    Join Date
    07-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Export Image Issues

    AlphaFrog -

    That worked perfectly, brilliant!! Thank you both for your help.

    Kenneth-
    I'm a bit of a VBA newb so I did not follow your instructions properly regarding the microsoft objects library. I will try that when I have time as well though. Your assistance is greatly appreciated.

  7. #7
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Export Image Issues

    Great! When ready, explore the many tutorials for learning like this one to set a reference. http://excel-macro.tutorialhorizon.c...es-vbaproject/

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Export an image as a png file
    By bibleguy125 in forum Excel General
    Replies: 2
    Last Post: 02-27-2012, 12:37 PM
  2. Export Image to folder as .gif
    By cman_c in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2009, 05:07 AM
  3. Export Worksheet to Image
    By RickyC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2009, 07:46 AM
  4. Excel 2007 : Excel to webpage image issues
    By tuckers_luck in forum Excel General
    Replies: 1
    Last Post: 02-04-2009, 10:12 AM
  5. Chart Export Issues
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2006, 06:45 AM

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