End Graph.exe process in powerpoint vba code

Hi,

I am modifying a graph with Powerpoint vba, each time I set the oGraphChart a new process of graph.exe begins, but when I clear my objects the process graph.exe remains in my task manager and each time I run my macro on another object another instance of graph.exe starts. How do I end the instance of graph.exe in my vba code?

Here is what I have tried but it does not end the process graph.exe


    Dim oGraphChart As Object
    Dim oDatasheet As Object
    Dim oSh As Shape

            Set oSh = ActiveWindow.Selection.ShapeRange(1)
            Set oGraphChart = oSh.OLEFormat.Object
            Set oDatasheet = oGraphChart.Application.datasheet
            With oDatasheet

.....

            end with

           
            Set oSh = Nothing
            Set oGraphChart = Nothing
            Set oDatasheet = Nothing
theomyshAsked:
Who is Participating?
 
irudykCommented:
After the End With add the line
            oGraphChart.Application.Quit
So, your code would be something like:
 

    Dim oGraphChart As Object
    Dim oDatasheet As Object
    Dim oSh As Shape

            Set oSh = ActiveWindow.Selection.ShapeRange(1)
            Set oGraphChart = oSh.OLEFormat.Object
            Set oDatasheet = oGraphChart.Application.datasheet
            With oDatasheet

.....

            end with

            
            oGraphChart.Application.Quit
            Set oDatasheet = Nothing
            Set oGraphChart = Nothing
            Set oSh = Nothing

Open in new window

0
 
theomyshAuthor Commented:
Thank you so much!!!!!
0
 
theomyshAuthor Commented:
I just noticed that my graphs do not update when I added oGraphChart.Application.Quit

Is there an update or save step I should be doing?
0
 
irudykCommented:
Hmm, I'm not sure why that would be the case since after updating values in the datasheet object results in my graph updating automatically.  I notice that in my code after:
     Set oSh = ActiveWindow.Selection.ShapeRange(1)
I have
     oSh.Activate
Maybe that would make a difference for you?
0
 
irudykCommented:
Also, maybe enter:
     oGraphChart.Application.Update
before the line
     oGraphChart.Application.Quit
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.