Consulting

Results 1 to 4 of 4

Thread: show/play powerpoint in userform WeBbrowser?

  1. #1

    show/play powerpoint in userform WeBbrowser?

    Hi

    Ive searched...and searched this one and can find plenty of info on adding useforms in powerpoints but nothing really useful for showing powerpoints in userforms.

    the closest ive found is below, which gives no errors, but cant display the "web page".. indicating its still just working as a WebBroweser and simply doesnt recognise the url.
    [VBA]Private Sub UserForm_Initialize()

    Me.WebBrowser2.Navigate2 sAPPPATH & "Random.ppt"

    End Sub[/VBA]

  2. #2
    Any ideas, anyone?

  3. #3
    And searched some more... surely this can be done guys.

  4. #4
    ok, this is the closest ive been able to find

    It basically opens a constrained ppt window. without being able to find a way to do it as id hoped, id like to know how to adapt this to allow me to open the ppt based on a cell range, as i have various different presentations id like users to be able to search from.


    [VBA]Option Explicit

    Public Sub RunThePowerpointTour()

    ' Constant for the title on the userform
    Const szAppName As String = "PowerPoint Window Tour"

    ' Constant for the Powerpoint file to load
    Const szShowName As String = "TestpptShow.ppt"

    ' PowerPoint Constant
    Const ppShowTypeInWindow = 3000

    ' Late binding to avoid setting reference:
    Dim oPPTApp As Object
    Dim oPPTPres As Object


    ' Store this Excel file path, and add a path seperator if needed:
    Dim szShowPath As String
    szShowPath = FixTrailingSeparator(ThisWorkbook.Path)


    ' Create the path to the where the show should be:
    Dim szValidShowPath As String
    szValidShowPath = szShowPath & szShowName


    ' Initialize an instance of Powerpoint
    On Error Resume Next
    Set oPPTApp = CreateObject("PowerPoint.Application")


    ' If we got one okay, continue
    If Not oPPTApp Is Nothing Then


    ' With our new instance, open the preset ppt file:
    Set oPPTPres = oPPTApp.Presentations.Open(szValidShowPath, , , False)


    ' If it was found okay, continue on:
    If Not oPPTPres Is Nothing Then


    ' What to do with the presentation?
    With oPPTPres

    With .SlideShowSettings


    ' Show it in it's own window
    .ShowType = ppShowTypeInWindow

    ' Run it of course
    .Run


    End With

    End With

    Else

    ' if the presentation could not be shown:
    MsgBox "Presentation could not be found", 16, szAppName

    End If

    Else

    ' If Powerpoint is possibly not available on the machine:
    MsgBox "Powerpoint could not be found", 16, szAppName

    End If


    ' Explicitly clear memory
    Set oPPTApp = Nothing
    Set oPPTPres = Nothing
    End Sub


    Public Function FixTrailingSeparator(Path As String, _
    Optional PathSeparator As String = "\") As String
    ' Xcav8r

    Select Case Right(Path, 1)
    Case PathSeparator
    FixTrailingSeparator = Path
    Case Else
    FixTrailingSeparator = Path & PathSeparator
    End Select

    End Function
    [/VBA]

Posting Permissions

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