PDA

View Full Version : Open a PPS file VBA



thomas.szwed
12-17-2007, 08:12 AM
Here is my current code to open a ppt file. Can anyone tell me how to change this to open a .pps? .pps loads up your presentation straight into a show.

2. It also doesnt seem to like the path of my file.....i cant use drive letters as each user has their drive mapped differently. Can you help?


Sub HelpGuide()
Set pptfile = CreateObject("Powerpoint.Application")
pptfile.Visible = True
Set pShow = pptfile.Presentations.Open("\\ukyorw09\HR\IAC (file://\\ukyorw09\HR\IAC) New Starter Tracking\IAC\Application\Properties\IAC End User Guide.ppt")
End Sub



THanks

thomas.szwed
12-17-2007, 09:58 AM
anybody!!!!!!?

unmarkedhelicopter
12-17-2007, 10:33 AM
Do not re-post to an open thread, merely to ask for input, I WAS putting code together for you on this but due to your post ... I've now lost it ... :)

thomas.szwed
12-18-2007, 02:21 AM
:dunno

Bob Phillips
12-18-2007, 02:56 AM
A word of advice. Try things.

What happens if you try that code with a pps file?

thomas.szwed
12-18-2007, 03:03 AM
Still doesnt work, believe me im not dumb, i do try . Ends up with a 424 error. This is the code im using....



Sub HelpGuide()
Set ppsfile = CreateObject("powerpoint.application")
ppsfile.Visible = True
Set pShow = Presentations.Open("\\ukyorw09\HR\IAC (file://\\ukyorw09\HR\IAC) New Starter Tracking\IAC\Application\Properties\IAC End User Guide.pps")
End Sub



Its just a simple thing and he was being really arrogant about it.

metev
12-18-2007, 03:17 AM
what kind of Control are you using to open the pps file?
You can do this with a WebBrowserControl or with a button and when you click a .pps file loads.


Private Sub cmd_ppt_Click()
Dim strAddress As String
'Hier wird die ausgew?hlte PowerPoint Pr?sentation aufgerufen
On Error GoTo exitsub
strAddress = ThisWorkbook.Path & "\media\presentation\" & list_wahl.Value 'I select a .pps file from a ListBox and then load it
ActiveWorkbook.FollowHyperlink Address:=strAddress
Exit Sub

exitsub:
Exit Sub
End Sub

Bob Phillips
12-18-2007, 03:19 AM
Thomas,

I created a simple pps file, and ran that code opening pps not ppt, and it opened up fine in PPT. The only difference that I can see is that I use a mapped drive not a UNC.

thomas.szwed
12-18-2007, 03:24 AM
Do u mean opened fine in a PPS or PPT? PPS is the show not the editing mode of a presentation.....THanks

Bob Phillips
12-18-2007, 03:38 AM
You could try shelling it



Private Declare Function APIShellExecute 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

Public Const WIN_NORMAL = 1 'Open Normal
Public Const WIN_MAX = 3 'Open Maximized
Public Const WIN_MIN = 2 'Open Minimized

Private Const ERROR_SUCCESS = 32&
Private Const ERROR_NO_ASSOC = 31&
Private Const ERROR_OUT_OF_MEM = 0&
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&

Function ShellFile(Filename As String) As String
Dim mpReturn As Long

mpReturn = APIShellExecute(0, vbNullString, _
Filename, vbNullString, vbNullString, WIN_NORMAL)

If mpReturn > ERROR_SUCCESS Then
Else
Select Case mpReturn
Case ERROR_NO_ASSOC:
MsgBox "No file association"
Case ERROR_OUT_OF_MEM:
MsgBox "Error: Out of Memory/Resources"
Case ERROR_FILE_NOT_FOUND:
MsgBox "File not found"
Case ERROR_PATH_NOT_FOUND:
MsgBox "Path not found"
Case ERROR_BAD_FORMAT:
MsgBox "Bad File Format"
Case Else:
End Select
End If
End Function

thomas.szwed
12-18-2007, 05:01 AM
This code works........difference is on the third line.....



Sub HelpGuide()
Set ppsfile = CreateObject("powerpoint.application")
ppsfile.Visible = True
Set pShow = ppsfile.Presentations.Open("\\ukyorw09\HR\IAC (file://\\ukyorw09\HR\IAC) New Starter Tracking\IAC\Application\Properties\IAC User Guide.pps")
End Sub

Bob Phillips
12-18-2007, 05:52 AM
Of course, it's obvious isn't it LOL!