B
Burnsie
Hi,
I am having trouble using the filedialog. My program is designed to open a
template based on some user inputs. After the user has made changes to the
template and selected save, saveas or tries to close, I have created a class
that has code for the event PresentationBeforeSave. Based on the template, I
want to suggest a folder/filename via the FileDialog(msoFileDialogSaveAs). I
have no problem with this. However, I am unable to save the file in the
location I or the user has chosen. Furthermore, once the
PresentationBeforeSave finishes, another FileDialog Save As -- pop's up and
asks if the user wants to save changes to the presentation. The file name it
uses is the Slide 1 Title (ie. title is "Base Name", therefore it suggests
"Base Name.ppt" for the file name).
Private Sub App_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As
Boolean)
Dim dlgSaveAs As FileDialog
Dim strPath As String
Set Pres = ActivePresentation
Set dlgSaveAs = Pres.Application.FileDialog(msoFileDialogSaveAs)
With dlgSaveAs
.InitialFileName = "\Wedge\Test.ppt"
If .Show = -1 Then
.Execute
strPath = .InitialFileName
End If
End With
'This gives me a runtime error
'ActivePresentation.SaveAs FileName:=strPath
End Sub
Maybe it isn't possible to do what I want and will need to use a Window API
call instead.
Any thoughts/suggestions will be very much appreciated.
Thanks,
Burnsie
I am having trouble using the filedialog. My program is designed to open a
template based on some user inputs. After the user has made changes to the
template and selected save, saveas or tries to close, I have created a class
that has code for the event PresentationBeforeSave. Based on the template, I
want to suggest a folder/filename via the FileDialog(msoFileDialogSaveAs). I
have no problem with this. However, I am unable to save the file in the
location I or the user has chosen. Furthermore, once the
PresentationBeforeSave finishes, another FileDialog Save As -- pop's up and
asks if the user wants to save changes to the presentation. The file name it
uses is the Slide 1 Title (ie. title is "Base Name", therefore it suggests
"Base Name.ppt" for the file name).
Private Sub App_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As
Boolean)
Dim dlgSaveAs As FileDialog
Dim strPath As String
Set Pres = ActivePresentation
Set dlgSaveAs = Pres.Application.FileDialog(msoFileDialogSaveAs)
With dlgSaveAs
.InitialFileName = "\Wedge\Test.ppt"
If .Show = -1 Then
.Execute
strPath = .InitialFileName
End If
End With
'This gives me a runtime error
'ActivePresentation.SaveAs FileName:=strPath
End Sub
Maybe it isn't possible to do what I want and will need to use a Window API
call instead.
Any thoughts/suggestions will be very much appreciated.
Thanks,
Burnsie