Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Open power point presentation from ACCESS 2003 VBA

How does one open a power point presentation from Access 2003 via VBA?  I have a trainging presentation that I want user to be able to open from a button on an ACCESS 2003 form.  The power point is in version 2010.
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

I generally use the Application.Followhyperlink method.  All you need to add to that is the path and file name.
Yes, if all you need to do is "Open" the PP file then fyed has your answer here.

If you need anything special (Open parameters, run slide show automatically, ...etc) then you will need "Interoperability" code.

JeffCoachman
Avatar of Sandra Smith

ASKER

Ok, this did open it, but it opened it in design view.  Maybe I did not make myself clear and sorry about that, but I want the user to hit the button and have the presentation start running.  
Avatar of MAdS
MAdS

Try this:

Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3

Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
 (ByVal hwnd As Long, _
  ByVal lpOperation As String, _
  ByVal lpFile As String, _
  ByVal lpParameters As String, _
  ByVal lpDirectory As String, _
  ByVal nShowCmd As Long) As Long

Sub OpenFile()
 On Error Resume Next
 Call ShellExecute(0, "open", "[file-name]", , "[file-folder]", SW_SHOWMAXIMIZED)
End Sub 

Open in new window

P.S.: have you presentation saved as PPSX, not PPTX
Ok, it keeps crashing my system.
Now I get argument not optional
Sub OpenPowerPoint()
 On Error Resume Next
 Call ShellExecute(0, "open", "ProjectTaskTraining.ppsx", , "K:\DatabaseDevelopment\ProjectTaskTracking\", SW_SHOWMAXIMIZED)
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
System crashes when I try to run the code.  I will try your version fyed and see what happens.
Thank you, this worked.  The other seemed logical as far as I could tell, but my system just did not like it.

Sandra

Did you even try:

Application.FollowHyperlink "K:\DatabaseDevelopment\ProjectTaskTracking\ProjectTaskTraining.ppsx"
Yes I did, it was the first thing, but again, for whatever reason, my system would not process.  I am happy with what I have now.
Just FYI, I skipped 4th parameter. It should be:

Sub OpenPowerPoint()
 On Error Resume Next
 Call ShellExecute(0, "open", "ProjectTaskTraining.ppsx", "", "K:\DatabaseDevelopment\ProjectTaskTracking\", SW_SHOWMAXIMIZED)
End Sub