Link to home
Start Free TrialLog in
Avatar of jjxia2001
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.GetSaveAsFilename _
    (InitialFileName:=strFile, _
        FileFilter:="PDF Files (*.pdf), *.pdf", _
        Title:="Select Folder and FileName to save")
ASKER CERTIFIED SOLUTION
Avatar of Phillip Burton
Phillip Burton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjxia2001
jjxia2001

ASKER

Thanks!