jjxia2001
asked on
In VBA, create workbook name with ".pdf" as a default name
I'm using the following codes to create a pdf file from xlsm file, but I got this shown up in the default name window - "CNS WC KE Tool Updated 9-29-14.xlsm20141001_1026. pdf". How can I remove ".xlsm" from the default name window? Thanks.
strFile = Replace(Replace(ws.Name, " ", ""), ".", "_") _
& "_" _
& ActiveWorkbook.FullName _
& Format(Now(), "yyyymmdd\_hhmm") _
& ".pdf"
FolderName = "C:\Users\" & User_Name & "\Desktop\"
strFile = FolderName & strFile
myFile = Application.GetSaveAsFilen ame _
(InitialFileName:=strFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
strFile = Replace(Replace(ws.Name, " ", ""), ".", "_") _
& "_" _
& ActiveWorkbook.FullName _
& Format(Now(), "yyyymmdd\_hhmm") _
& ".pdf"
FolderName = "C:\Users\" & User_Name & "\Desktop\"
strFile = FolderName & strFile
myFile = Application.GetSaveAsFilen
(InitialFileName:=strFile,
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER