control PowerPoint from Access

I have a sub routine in Access that creates a table on a PowerPoint Slide and then pastes a couple of graphs from an Access graph object onto the slide below the table.

The use has the option of doing this in an open PowerPoint presentation or of creating a new PowerPoint presentation.

When they choose the alread open PowerPoint presentation, it works fine.

But, if they choose a new Powerpoint presentation, I want all the action to happen out of sight.  While creating the table, everything works, but to paste in the graphs, I must first activate the PowerPoint application so I can access the active window.  This causes the PowerPoint presentation to flash to the front of the screen and then go to the background and the document is left open.

When controlling Word, I can set ScreenUpdating to false to avoid this.

What is the equivalent technique in PowerPoint?
LVL 1
wsturdevAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

do not activate the powerpoint object

see this link

How to Create an MS Graph in PowerPoint Using Access

http://support.microsoft.com/?kbid=200551


0
 
puppydogbuddyCommented:
Here is another good link for reference:

        http://support.microsoft.com/?kbid=209960
0
 
puppydogbuddyCommented:
PS

The following link is a PowerPoint add-in that you should be aware of, although it is really not within the scope of your question.

            http://www.turbodemo.com/eng/nx.php
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
wsturdevAuthor Commented:
Let me ask my question a different way.  Here is the code I am using to copy a graph from an Access form and Paste it into a PowerPoint slide (rather than create a graph on a PowerPoint slide)

Dim pptDocument As Object
Dim pptApp As Object
Dim pptSlide As Slide
Dim pptShape As Object
Dim pptPresentation As Presentation
Set pptApp = CreateObject("PowerPoint.Application")
pptApp.Presentations.Add
Set pptPresentation = pptApp.Presentations(1)
With pptApp
    Set GraphObj = Me.SubFrm_My_Graph_Form.Form.Average_Business_Scores.Object.Application.Chart
    GraphObj.ChartArea.Copy
    pptApp.Visible = msoTrue
    pptApp.ActiveWindow.View.Paste
               
    With pptApp.ActiveWindow.Selection.ShapeRange
        .Left = 35
        .Top = 225
        .Width = 301
        .Height = 261
    End With
End With

In order to use the statement "pptApp.ActiveWindow.View.Paste"
and then "With pptApp.ActiveWindow.Selection.ShapeRange"
I must first say "pptApp.Visible = msoTrue".

This causes the PowerPoint application to come to the front, which is what I do not want.

If I eliminate "pptApp.Visible = msoTrue", then I cannot do the paste.

How can I paste the graph onto the slide without having to show the PowerPoint window?
0
 
wsturdevAuthor Commented:
I figured it out:

                Set GraphObj = Me.SubFrm_APER_Tables_Summary_Display.Form.Average_Business_Scores.Object.Application.Chart
                GraphObj.ChartArea.Copy
                'pptApp.Visible = msoTrue
                'pptApp.ActiveWindow.View.Paste
                With pptPresentation
                    pptSlide.Shapes.Paste
                    With pptSlide.Shapes(pptSlide.Shapes.Count)
                        .Left = 35
                        .Top = 225
                        .Width = 301
                        .Height = 261
                    End With
                End With
0
 
Rey Obrero (Capricorn1)Commented:
i think my comment for not activating the powerpoint object leads to the solution of the questioner's problem.

if the questioner thinks that the comments posted did not merit anything, then who am i to object....
0
 
wsturdevAuthor Commented:
Had I posted my clarification as my original question, you would have seen that I was trying to Paste into the Active Window, and that technique REQUIRED that PowerPoint be activated.  Based on that, not activating PowerPoint was not an option, so in my mind your answer did not lead to the solution because I could not use it.

However, as I continued to look at the problem, and while I was responding to you to get further help, I realized I could do the paste into a Presentation object rather than into the active window, and that technique could be done "invisibly", the solution which I posted as "having found the answer myself"

Since I set the question up poorly, you could only have answered as you did, and your answer was technically correct, so I award you the points.
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.