+ Reply to Thread
Results 1 to 2 of 2

Save excel file as pdf with cell reference to date/time for naming

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    Kansas
    MS-Off Ver
    2013
    Posts
    1

    Save excel file as pdf with cell reference to date/time for naming

    Stuck on the coding issue for this problem. I am trying to have my excel file automatically save as a pdf file with a time stamp. EX filename.ddmmyy pdf. Any ideas on where i messed up the syntax. Not sure if it is the file path or something else that I may have screwed up.

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Range("S5").Value, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Save excel file as pdf with cell reference to date/time for naming

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    its probably the format of the timestamp as default uses "/" as date seperators which cannot be used when saving files

    quick fix would be
    Filename:=replace(Range("S5").Value,"/","-")

    if you are using time as well then you will need to repeat this with ":" which also cannot be used to name files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save File with Date and Time Stamp
    By Andibevan in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-26-2019, 12:46 AM
  2. Replies: 9
    Last Post: 06-18-2015, 03:12 PM
  3. [SOLVED] Macro to save file - save name from cell containing a date using different date formatting
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2014, 12:18 PM
  4. [SOLVED] macro to save file to specific folder with file name from cell reference
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2013, 11:32 AM
  5. save file as date and time
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2011, 05:47 AM
  6. Macro to save Excel file with date and time in the file name?
    By sonic_d_hog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2006, 02:00 PM
  7. Save file with time date stamp
    By oberon.black in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2005, 09:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1