Link to home
Start Free TrialLog in
Avatar of wsturdev
wsturdevFlag for United States of America

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of puppydogbuddy
puppydogbuddy

Here is another good link for reference:

        http://support.microsoft.com/?kbid=209960
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
Avatar of wsturdev

ASKER

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?
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
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....
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.