VBA Q: syntax to paste special in PP from XL?

K

Keith R

I have a task where I have to paste 24 separate pages (containing multiple
graphs each) into powerpoint monthly.

I decided (since I've done some work in Excel VBA) that this should be easy
to automate.

I'm having trouble with the syntax for the PP side of things (VBA is
located inside the XL workbook).

I need it to "paste special" as an enhanced metafile.

Here's a section of my code, adapted from the MS VBA automation help file:
I've noted the one line below that doesn't work
Using Office 97
TIA,
Keith

---------------------------------------------------
Sub CreatePresentation()
Dim ppt As PowerPoint.Application
ReDim newSlide(1 To 4) As PowerPoint.Slide
Dim lngHeight As Long
Dim lngWidth As Long
Dim pres As PowerPoint.Presentation
Dim pptShape As PowerPoint.Shape

'Create the PowerPoint Object
Set ppt = CreateObject("PowerPoint.Application")
Set pres = ppt.Presentations.Add 'Adds a blank presentation
lngHeight = pres.PageSetup.SlideHeight
lngWidth = pres.PageSetup.SlideWidth

Set newSlide(1) = pres.Slides.Add(1, ppLayoutBlank)

'Excel.ActiveWorkbook.
'Windows("FY04QData_091903k.xls").Activate
Sheet13.Activate
Sheet13.Range("A1:AF46").Select
Excel.ActiveWorkbook.Sheets("V1").Range("AF46").Activate
Selection.Copy

ppt.Activate
With ppt
ActiveWindow.Selection.SlideRange.Shapes.Paste '<--
' I tried many variations of syntax, but I just don't
know PP
' well enough to know the keywords or how to manipulate
it
' to paste special/ enhanced metafile
End With

pptShape.ZOrder msoSendToBack
Next
pres.SaveAs "c:\windows\desktop\pptExample1", ppSaveAsPresentation
ppt.Quit 'Close PowerPoint
Set ppt = Nothing 'Clear the object
End Sub
 

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