wsturdev
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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.A pplication ")
pptApp.Presentations.Add
Set pptPresentation = pptApp.Presentations(1)
With pptApp
Set GraphObj = Me.SubFrm_My_Graph_Form.Fo rm.Average _Business_ Scores.Obj ect.Applic ation.Char t
GraphObj.ChartArea.Copy
pptApp.Visible = msoTrue
pptApp.ActiveWindow.View.P aste
With pptApp.ActiveWindow.Select ion.ShapeR ange
.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.Select ion.ShapeR ange"
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?
Dim pptDocument As Object
Dim pptApp As Object
Dim pptSlide As Slide
Dim pptShape As Object
Dim pptPresentation As Presentation
Set pptApp = CreateObject("PowerPoint.A
pptApp.Presentations.Add
Set pptPresentation = pptApp.Presentations(1)
With pptApp
Set GraphObj = Me.SubFrm_My_Graph_Form.Fo
GraphObj.ChartArea.Copy
pptApp.Visible = msoTrue
pptApp.ActiveWindow.View.P
With pptApp.ActiveWindow.Select
.Left = 35
.Top = 225
.Width = 301
.Height = 261
End With
End With
In order to use the statement "pptApp.ActiveWindow.View.
and then "With pptApp.ActiveWindow.Select
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?
ASKER
I figured it out:
Set GraphObj = Me.SubFrm_APER_Tables_Summ ary_Displa y.Form.Ave rage_Busin ess_Scores .Object.Ap plication. Chart
GraphObj.ChartArea.Copy
'pptApp.Visible = msoTrue
'pptApp.ActiveWindow.View. Paste
With pptPresentation
pptSlide.Shapes.Paste
With pptSlide.Shapes(pptSlide.S hapes.Coun t)
.Left = 35
.Top = 225
.Width = 301
.Height = 261
End With
End With
Set GraphObj = Me.SubFrm_APER_Tables_Summ
GraphObj.ChartArea.Copy
'pptApp.Visible = msoTrue
'pptApp.ActiveWindow.View.
With pptPresentation
pptSlide.Shapes.Paste
With pptSlide.Shapes(pptSlide.S
.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....
if the questioner thinks that the comments posted did not merit anything, then who am i to object....
ASKER
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.
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.
http://support.microsoft.com/?kbid=209960