Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

powerpoint 2007 macro error

Status
Not open for further replies.

raphael75

Programmer
Nov 15, 2012
67
US
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:


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!
 
hi,

Are you ABSOLUTELY SURE that your path is correct?

This code works!

If I make my path INCORRECT, I get your error message!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
When I actually tested it, I used a different path that I know works if I manually save the files.
 
Documents" does not actually exist as a location on the hard drive unless you made it yourself (I am assuming you are using Windows 7 based on "users" and "documents"). Try doing a hard path

c:\users\username\desktop\
 
Hi there.
Try this instead:
Code:
Set objShell = WScript.CreateObject("WScript.Shell")
strDocuments = objShell.SpecialFolders.Item("MyDocuments")
ActivePresentation.ExportAsFixedFormat strDocuments & "\test.pdf",... .. .. ... .. ..

This will give the "My Documents" folder regardless of who is currently logged on.
:)

Regards,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top