Excel/SaveAsPdf

Advertisement


Question
Hello i want to create a macro in excel 2013 that will save as pdf file with the current date as a name.Thank you very much

Answer
Dear Dimitris,

Please use the below macro. It should give the desired results

Sub command1_click()
   Dim flpth As String
   flname = Format(Date, "mmm-dd-yyyy")
   flpth = ThisWorkbook.Path & "\" & flname
   ActiveSheet.ExportAsFixedFormat _
   Type:=xlTypePDF, _
   Filename:=flpth, _
   Quality:=xlQualityStandard, _
   IncludeDocProperties:=True, _
   IgnorePrintAreas:=False, _
   OpenAfterPublish:=True
End Sub

Please note: You'll need to take care and make sure that the print formatting, alignment of text, page setup etc are done properly for your file, else the pdf output may not appear properly.

Hope this helps,
Thanks,
Gulshan.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


GULSHAN PURSWANI

Expertise

I can answer questions related to the following topics: 1. MS Excel - Creating and Linking Formulae, Running Pivot Tables, Vlookup etc. 2. Macros / VBA - Creating Macros to do specific jobs. Importing / Exporting / Validating Data in excel through Macros.

Experience

I've been working on excel for over 10 years and on VBA macros for over 3 years now.

Education/Credentials
Bachelor of Commerce, Chartered Accountant from The Institute of Chartered Accountants of India

©2016 About.com. All rights reserved.