I need to push a button in Excel, have it prompt the user to with the Open dialog box in PowerPoint. If the user clicks "Cancel" I want it to go back to Excel, but not close PowerPoint. Here's the code I have so far:
Any ideas??[/code]
Code:
Sub Open_A_Presentation()
Dim Master As Variant
Const ppWindowMaximized As Integer = 3
Dim PPTApp As Object
Dim fd As FileDialog
Dim CountItemSelected As Variant
Dim Open_Name As Variant
Master = ActiveWorkbook.Name
Set PPTApp = CreateObject("PowerPoint.Application")
With PPTApp
.Visible = True
.WindowState = ppWindowMaximized
.Activate
End With
Set fd = PPTApp.FileDialog(msoFileDialogOpen)
With fd
.FilterIndex = 2
.AllowMultiSelect = False
.InitialFileName = "D:\"
.Show
End With
CountItemSelected = fd.SelectedItems.Count
If CountItemSelected = 0 Then
********WHAT DO I PUT HERE??*********
*******I've tried the following, but none of them work!********
'Windows(Master).Visible = True
'Windows(Master).Activate
'ActiveWindow.WindowState = xlMaximized
'ActiveWindow.Application.Workbooks(Master).Activate
'Application.Workbooks(Master).Activate
MsgBox "Action Cancelled", , "Open PowerPoint Presentation"
Exit Sub
End If
Open_Name = fd.SelectedItems.Item(1)
PPTApp.Presentations.Open Open_Name
PPTApp.ActivePresentation.Slides(1).Select
With PPTApp.ActivePresentation.SlideShowSettings
.ShowType = ppShowTypeSpeaker
.AdvanceMode = ppSlideShowManualAdvance
.Run
End With
Set fd = Nothing
End Sub
Any ideas??[/code]