Solved

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

Posted on 2014-10-01
2
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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 on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

749 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