Solved

In VBA, create workbook name with ".pdf" as a default name

Posted on 2014-10-01
2
199 Views
Last Modified: 2014-10-01
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")
0
Comment
Question by:jjxia2001
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40354869
Change the third line, ActiveWorkbook.FullName, to

Replace(ActiveWorkbook.FullName,".xlsm","") 

Open in new window

0
 

Author Closing Comment

by:jjxia2001
ID: 40354928
Thanks!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now