PDA

View Full Version : [SOLVED] Open Powerpoint file from Excel



Nicolaf
10-20-2015, 01:13 AM
Hi,

I have some code from a previous post to open a Powerpoint presentation from Excel see below:


Private Sub CommandButton28_Click()
' Opens Presentation.pptx

Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="P:\lonib\Presentation.pptx"

End Sub

Now the file I would like to open (Presentation.pptx) is password protected so I would like to open without being asked for password.


I tried amending code to below:


[Private Sub CommandButton28_Click()
' Opens Presentation.pptx

Dim PPT As PowerPoint.Application

Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="P:\lonib\Presentation.pptx", Password:="Password"

End Sub

But when I run this macro I get error message "Compile error: Named argument not found"

What am I doing wrong?
How should code be amended so that file opens without asking for password and no Compile error message?

Thanks,
Nic
:think::think:

mancubus
10-20-2015, 01:58 AM
check this out:

http://officeone.mvps.org/openppt/

Nicolaf
10-20-2015, 02:02 AM
Great thanks!
Nic

:hi::hi:

mancubus
10-20-2015, 02:14 AM
you are welcome.

please mark the thread as solved for future references.