[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

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?
0
wsturdev
Asked:
wsturdev
  • 3
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now