+ Reply to Thread
Results 1 to 2 of 2

Macro to Export Charts as PNG

  1. #1
    Registered User
    Join Date
    08-13-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    1

    Macro to Export Charts as PNG

    Hi all,

    I am new to macros and I am trying to export 20 charts that are one worksheet. I found the code below online and it it does work for a majority of the charts. However, it randomly skips some of the charts and does not export the. I recevie an Run Time error 76; Path not found. Each chart is named. Any ideas? Thank you
    Justin

    Sub Create_Png()

    Dim objCht As ChartObject
    Dim strPath As String

    strPath = "C:\Path Name"

    For Each objCht In ActiveSheet.ChartObjects
    objCht.Chart.Export strPath & objCht.Name & ".png", FilterName:="png"
    Next

    End Su

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Macro to Export Charts as PNG

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    Please Login or Register  to view this content.
    I assume the folder 'Path Name' exists?
    Is it really skipping charts or is it possible the chart name for multiple objects is the same?
    Cheers
    Andy
    www.andypope.info

+ 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. Replies: 32
    Last Post: 07-17-2018, 03:08 AM
  2. change order of graphs when using macro to export all excel charts to powerpoint
    By silencer27 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2014, 06:48 AM
  3. Export excel2000 charts into EMF/WMF
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-10-2006, 08:30 AM
  4. Excel should let me export charts as .eps or .png
    By milton585 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-21-2006, 09:40 PM
  5. export charts
    By tommy_gtr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2005, 09:07 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