JimS
04-26-2011, 12:06 PM
The following code was borrowed from another workbook and was working but for some reason it now fails with a Compile Error - it highlights the word "Date" in the "fNamef =" line.
Any ideas why this no longer works?
Thanks...
JimS
Sub Save_PPT()
Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim sPath, fName1, fNamef As String
sPath = "C:\MyData1 \"
fName1 = "Sample_Data"
fNamef = fName1 & "_" & Format(Date, "mmm-dd-yyyy") & "_" & Format(Time, "hh-mm-ss") & ".ppsm"
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile = oPPTApp.ActivePresentation
oPPTApp.Visible = msoTrue
oPPTFile.SaveAs Filename:=sPath & fNamef, FileFormat:=ppSaveAsDefault
oPPTFile.Close
oPPTApp.Quit
End Sub
Any ideas why this no longer works?
Thanks...
JimS
Sub Save_PPT()
Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim sPath, fName1, fNamef As String
sPath = "C:\MyData1 \"
fName1 = "Sample_Data"
fNamef = fName1 & "_" & Format(Date, "mmm-dd-yyyy") & "_" & Format(Time, "hh-mm-ss") & ".ppsm"
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile = oPPTApp.ActivePresentation
oPPTApp.Visible = msoTrue
oPPTFile.SaveAs Filename:=sPath & fNamef, FileFormat:=ppSaveAsDefault
oPPTFile.Close
oPPTApp.Quit
End Sub