Saturday, April 24, 2010

How to Save Powerpoint Presentation with Password using VBA

How to Specify the Password in SaveAs option in PowerPoint VBA

Unlike SaveAs in Word/Excel, which takes the Password as part of the argument, Powerpoint SaveAs function doesn't specify it.

Here is a way to do it through VBA

Sub Save_Presentation_With_Password()

Dim oPS As PowerPoint.Presentation
Dim sTempPath As String

Set oPS = Presentations.Add
oPS.Slides.Add 1, ppLayoutTitle

' ----------------------------
' Coded by Shasur for
' ----------------------------

sTempPath = Environ("Temp") & "\"

oPS.Password = "PPTPWD"

oPS.SaveAs FileName:=sTempPath & "PPTSample1.pptx", FileFormat:=ppSaveAsDefault

End Sub 

See also

Run Excel Macro from Powerpoint VBA

Save Powerpoint Slides as Images using VBA

Add Controls Popup Menu using Powerpoint VBA

VBA - Creating PowerPoint Presentation





No comments:

Post a Comment

Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO Google Group