Share via

Inserting a PDF file into Powerpoint using VBA

Anonymous
2015-06-05T13:56:34+00:00

I am trying to Insert a PDF file into Powerpoint using VBA.

The code I am using below, fails when the AddOLEObject line is run.

I get this error message:

Run-Time error '-2147483640 (80000008)':

Method 'AddOLEObject' of Object 'Shapes' failed. 

Sub PDFToPP10()

Dim oSh As Shape

Dim oSl As Slide

Dim sFileName As String

sFileName = "c:\Test PDF 04-Jun-15.pdf"

Set oSl = ActivePresentation.Slides(1) ' or whatever you want

' Assuming it's a letter-sized/portrait PDF:

Set oSh = oSl.Shapes.AddOLEObject(Left:=0, _

    Top:=0, _

    Width:=8.5 * 72, _

    Height:=11# * 72, _

    Filename:=sFileName, _

    Link:=msoFalse)

End Sub

Any suggestions?

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

John Korchok 232.8K Reputation points Volunteer Moderator
2015-06-05T17:53:48+00:00

OLE on the Mac only supports interaction among MS Office components like Word, PowerPoint, Excel, etc. Unlike Windows, no other programs are supported.

In addition, you're using a Windows-style path that you'll have to change to Mac.

However, you can still insert the PDF as a picture:

Sub InsertPhoto()

  ActiveWindow.Presentation.Slides(1).Shapes.AddPicture (FileName:="RAID0:Users:YourUserName:Documents:Test.pdf", LinkToFile:=False, SaveWithDocument:=msoTrue, Left:=1, Top:=1, Width:=85, Height:=110).Select

End Sub

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2015-06-05T16:11:15+00:00

    I don't believe that is supported in the Mac version of PowerPoint.

    Was this answer helpful?

    0 comments No comments