+ Reply to Thread
Results 1 to 4 of 4

ChartData Not Saving; Chart Not Refreshing

  1. #1
    Registered User
    Join Date
    04-19-2020
    Location
    Tampa, FL
    MS-Off Ver
    MSO Home and Student 2016
    Posts
    5

    ChartData Not Saving; Chart Not Refreshing

    Hi - I run code from Excel to create Powerpoint presentations. I've had a great deal of success over the years, but recently, the code stopped working. When I update the ChartData, and close / save it, the chart does not refresh. In fact, it appears the ChartData doesn't appear to save. When I reopen the chart data, the edits are gone. Note- If I set a breakpoint at the save line, and step through it, it works fine.

    This is the test code to repeat the issue.

    Please Login or Register  to view this content.
    I've tried just about everything I can think of after the update, and before running the save command, including the following code, in an attenpt to get the updates to register before closing and saving....

    Please Login or Register  to view this content.
    I'm running MS Excel 2016 MSO (16.0.13001.20266) 32-bit.

    Any help is appreciated. Thank you in advance.

    Mike

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

    Re: ChartData Not Saving; Chart Not Refreshing

    Your code worked for me using O365.

    I know pp automation can be a real pain as the objects seem to lag behind the code.

    I notice you do not make the powerpoint application visible. Is that just an omission in the posted code? If not try making the app visible one you create it.
    Try adding DoEvents to the code before saving chartdata. I normally add a few of them with a Sleep inbetween.
    Also, via code, try open/closeing the chartdata object again
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-19-2020
    Location
    Tampa, FL
    MS-Off Ver
    MSO Home and Student 2016
    Posts
    5

    Re: ChartData Not Saving; Chart Not Refreshing

    Hey Andy. Thanks for replying. I've tried putting a number of things before the save -- including: Application.wait 1000, sleep 1000, doEvents, etc.... When I put this code in a loop and run it 10 times, even with all the waits, sleeps, and doEvents, only 20-40% of the runs work as expected. It's awfully random.

    I added a few things, and it's giving me more reliable results now:


    Added powerpointApp.visible and activate commands:

    Please Login or Register  to view this content.
    Added mySlide.Select to make sure powerpoint has the slide activated:

    Please Login or Register  to view this content.
    After making chartdata updates, and before saving, run a "wasteTime" function (see myonlinetraininghub's article on pausing-or-delaying-vba-using-wait-sleep-or-a-loop). Other methods I tried, Application.wait or sleep, didn't give the same results.

    Please Login or Register  to view this content.
    When I implemented these changes into my production code, I had to include DoEvents, and calculate the chartdata worksheet, in addition to the wasteTime call:

    Please Login or Register  to view this content.
    Thanks for your attention on this issue.

    Mike

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

    Re: ChartData Not Saving; Chart Not Refreshing

    When I do powerpoint report automation I run from Powerpoint and create Excel application.

+ 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. Pivot Table formatting not saving when refreshing data
    By satch413 in forum Excel General
    Replies: 1
    Last Post: 04-08-2019, 02:19 PM
  2. Pivot Table formatting not saving when refreshing data
    By satch413 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-08-2019, 07:20 AM
  3. [SOLVED] Opening, refreshing data connections, saving and closing file with VBA
    By jtukes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2013, 03:31 PM
  4. Data Connections : Saving history before refreshing?
    By brianlg in forum Excel General
    Replies: 0
    Last Post: 10-10-2013, 12:07 PM
  5. Opening, refreshing, saving, and closing a closed workbook
    By hootiebsc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2013, 05:22 PM
  6. Resizing chart because of refreshing Chart Data through a query
    By jayb in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-10-2006, 11:25 AM
  7. [SOLVED] MSChart.chartdata + Excel Names
    By francois in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2005, 08:06 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