Hi! I want to open a pptx file and save as it directly with a dialog box or a prompt shows up allowing the user to choose a location to save it and what file name.
I do not want to open the pptx file so I added the .visible false and it does not work. other than that, removing that line of code, I can't still save as my pptx file
I tried this code but to no luck
Code
Sub saveApptFile()
Dim objPPT As Object, pptDoc As Object, path As String
Dim dlgSaveAs As FileDialog, fileSaveName As Variant
path = ThisWorkbook.path & Application.PathSeparator & "/TEMPLATEFOLDER/pptTemp.pptx"
Set objPPT = CreateObject("PowerPoint.Application")
Set pptDoc = objPPT.Presentations.Open(path)
objPPT.Visible = False
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="PPT Documents (*.pptx), *.pptx")
If fileSaveName <> False Then
objPPT.ActivePresentations.SaveAs Filename:=fileSaveName_
FileFormat:=ppFormatPresentationsDefault
objPPT.Presentations.Open fileSaveName
objPPT.Visible = True
objPPT.Activate
Else
MsgBox "cancelled."
End If
End Sub
Display More
Any help will be appreciated! Thank you.