0
votes

I'm trying to create a simple macro in powerpoint 2007 to save the active presentation as a pdf. I tried the example on the MS site here:

http://msdn.microsoft.com/en-us/library/office/ff746080.aspx

Public Sub ExportAsFixedFormat_Example() 

   ActivePresentation.ExportAsFixedFormat "C:\Users\username\Documents\test.pdf", ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoCTrue, ppPrintHandoutHorizontalFirst, ppPrintOutputBuildSlides, msoFalse, , , , False, False, False, False, False 

End Sub

and I keep getting this error:

run-time error '-2147467259 (80004005)':
Method ExportAsFixedFormat of object '_Presentation' failed

What does this mean & how can I fix it? Thanks!

1
The ability to save as PDF wasn't built into the first release of Office 2007; you had to download it as a free add-in. As of SP1, I think it was, Save as PDF was built in. Make sure you have at least SP1. Also, have you tried saving the same file manually or running the same macro on a very simple file? - Steve Rindsberg

1 Answers

0
votes

Most likely the path to store that pdf file does not exist or permission denied!

Try:

Public Sub ExportAsFixedFormat_Example()
    Dim sFDR As String
    sFDR = Environ("USERPROFILE") & "\Documents\"
    ActivePresentation.ExportAsFixedFormat _
        Path:=sFDR & "test.pdf", _
        FixedFormatType:=ppFixedFormatTypePDF, _
        Intent:=ppFixedFormatIntentScreen, _
        FrameSlides:=msoCTrue, _
        HandoutOrder:=ppPrintHandoutHorizontalFirst, _
        OutputType:=ppPrintOutputBuildSlides, _
        PrintHiddenSlides:=msoFalse
End Sub