gringo287
11-17-2012, 05:27 AM
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.
Private Sub UserForm_Initialize()
Me.WebBrowser2.Navigate2 sAPPPATH & "Random.ppt"
End Sub
gringo287
11-27-2012, 02:30 PM
And searched some more... surely this can be done guys.
gringo287
11-27-2012, 03:30 PM
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.
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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.