Consulting

Results 1 to 12 of 12

Thread: Open a PPS file VBA

  1. #1

    Question Open a PPS file VBA

    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?

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


    THanks
    Last edited by thomas.szwed; 12-17-2007 at 09:57 AM.

  2. #2

    Unhappy

    anybody!!!!!!?

  3. #3
    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 ...
    2+2=9 ... (My Arithmetic Is Mental)

  4. #4

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A word of advice. Try things.

    What happens if you try that code with a pps file?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Still doesnt work, believe me im not dumb, i do try . Ends up with a 424 error. This is the code im using....

    [VBA]

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

    [/VBA]

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

  7. #7
    VBAX Regular
    Joined
    Aug 2007
    Posts
    16
    Location
    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.

    [vba]
    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
    [/vba]

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9

    Question

    Do u mean opened fine in a PPS or PPT? PPS is the show not the editing mode of a presentation.....THanks

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You could try shelling it

    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  11. #11
    This code works........difference is on the third line.....

    [VBA]

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

    [/VBA]

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Of course, it's obvious isn't it LOL!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •