Access Interact Programmatically with PowerPoint

  • Thread starter Bill Sturdevant
  • Start date
B

Bill Sturdevant

I have posted an identical question in the Access Programming forum, but
wanted to post it here as well in the hopes someone on this end will see it
and offer a solution:

I have an Access 2003 App that I have converted to Access 2007 -- a dictated
migration I am stuck with.

The app interacts programmatically with PowerPoint. The code below, which
copies a graph object in Access and pastes it into a PPT Presentation slide,
worked fine with Access 2003 and PowerPoint 2003. But, it fails in 2007.
The instruction:
pptSlide.Shapes.Paste
gets error:
Method 'Paste' of object 'Shapes' failed

It has been suggested that my code will not work because charting in PPT is
based on Excel and not on MS Graph. But, since I can stop the code
immediately after the "copy", then go to a PPT presentation and paste the
graph successfully, its seems I should be able to do so programmatically.

What do I need to change to get this working again?

--
Bill

Here is the code:
g_Four_R_GraphObj.ChartArea.Copy
With pptApp
With pptPresentation
If .Slides.count = 0 Then
Set pptSlide = .Slides.Add(1, ppLayoutTitleOnly)
Else
lngCurrentSlideIndex =
pptApp.ActiveWindow.View.Slide.SlideIndex + 1
Set pptSlide = .Slides.Add(lngCurrentSlideIndex,
ppLayoutTitleOnly)
End If

sText = Me.Chart_Title
pptSlide.Shapes.Title.TextFrame _
.TextRange.Text = sText
pptSlide.Shapes.Title.TextFrame.TextRange.Font.Size = 28
pptSlide.Shapes.Title.TextFrame.TextRange.Font.Bold = msoTrue

pptSlide.Shapes.Paste
With pptSlide.Shapes(pptSlide.Shapes.count)
.Left = 42
.Top = 114
.Width = 637
.Height = 377
End With

sText = Parent.Quadrant_Counts
pptSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 42,
486, 637, 15).TextFrame _
.TextRange.Text = sText
pptSlide.Shapes(pptSlide.Shapes.count).TextFrame _
.TextRange.Font.Size = 12
pptSlide.Shapes(pptSlide.Shapes.count).TextFrame _
.TextRange.Font.Bold = msoTrue
pptSlide.Shapes(pptSlide.Shapes.count).TextFrame _
.TextRange.ParagraphFormat.Alignment =
ppAlignCenter

End With
End With
 
B

Bill Sturdevant

This process is supposed to be automatic... the user uses some filters and
clicks some buttons to "assemble" the chart in Access. When ready, they
click a button and the logic moves the chart, as a chart, to PPT.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top