How to Select A Powerpoint file to insert into a from a list box instead of hard

  • Thread starter cesemj via AccessMonster.com
  • Start date
C

cesemj via AccessMonster.com

Hello I have a form that inserts a powerpoint presentation, but, the problem
I have is that I have to hard code the file. Is there a way for the user to
select the file from a popup list box or from he HD.
Please help.


Private Sub insertShow_Click()
On Error GoTo insertShow_Click_Error

' Open PowerPoint
Dim strPowerPointFile As String
Dim pptobj As PowerPoint.Application
Set pptobj = New PowerPoint.Application
pptobj.Visible = True
pptobj.WindowState = ppWindowMinimized

strPowerPointFile = CurrentProject.Path & "\TEST_1.ppt"

' Fill a collection with all Slide IDs.
With pptobj.Presentations.Open(strPowerPointFile)
Set mcolSlideIDs = New Collection
Dim ppSlide As PowerPoint.Slide
For Each ppSlide In .Slides
mcolSlideIDs.Add ppSlide.SlideID
Next
.Close
End With

' Close PowerPoint
pptobj.Quit
Set pptobj = Nothing

' Make object frame visible and enable "navigation" buttons.
pptFrame.Visible = True
firstSlide.Enabled = True
lastSlide.Enabled = True
nextSlide.Enabled = True
previousSlide.Enabled = True

' Specify OLE Class, Type, SourceDoc, SourceItem and other properties.
With pptFrame
.Class = "Microsoft Powerpoint Slide"
.OLETypeAllowed = acOLELinked
.SourceDoc = strPowerPointFile
End With
API_PlaySound "c:\windows\media\20th_century_fox.wav"
SetSlide 1

firstSlide.SetFocus
insertShow.Enabled = False

Exit Sub

insertShow_Click_Error:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
 
J

John Nurick

See www.mvps.org/access/api/api0001.htm

Hello I have a form that inserts a powerpoint presentation, but, the problem
I have is that I have to hard code the file. Is there a way for the user to
select the file from a popup list box or from he HD.
Please help.


Private Sub insertShow_Click()
On Error GoTo insertShow_Click_Error

' Open PowerPoint
Dim strPowerPointFile As String
Dim pptobj As PowerPoint.Application
Set pptobj = New PowerPoint.Application
pptobj.Visible = True
pptobj.WindowState = ppWindowMinimized

strPowerPointFile = CurrentProject.Path & "\TEST_1.ppt"

' Fill a collection with all Slide IDs.
With pptobj.Presentations.Open(strPowerPointFile)
Set mcolSlideIDs = New Collection
Dim ppSlide As PowerPoint.Slide
For Each ppSlide In .Slides
mcolSlideIDs.Add ppSlide.SlideID
Next
.Close
End With

' Close PowerPoint
pptobj.Quit
Set pptobj = Nothing

' Make object frame visible and enable "navigation" buttons.
pptFrame.Visible = True
firstSlide.Enabled = True
lastSlide.Enabled = True
nextSlide.Enabled = True
previousSlide.Enabled = True

' Specify OLE Class, Type, SourceDoc, SourceItem and other properties.
With pptFrame
.Class = "Microsoft Powerpoint Slide"
.OLETypeAllowed = acOLELinked
.SourceDoc = strPowerPointFile
End With
API_PlaySound "c:\windows\media\20th_century_fox.wav"
SetSlide 1

firstSlide.SetFocus
insertShow.Enabled = False

Exit Sub

insertShow_Click_Error:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
 
Top