+ Reply to Thread
Results 1 to 3 of 3

Amend VBA to add dd-mm-yyyy at end of file name as it show 5-2-2018 instead of 05-02-2018

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    474

    Question Amend VBA to add dd-mm-yyyy at end of file name as it show 5-2-2018 instead of 05-02-2018

    Hi,

    I’m trying to modify a section of VBA code which saves a file with today’s date at the end of the file name e.g. Myfilename (dd-mm-yyyy).xlxs

    Whilst the code does work it populates the file as 'Myfilename 5-2-2018.xlxs' i.e. it drops the leading zero of the day (05) and leading zero of the month (02) instead of being 'Myfilename 05-02-2018.xlxs'

    Can anyone please advise me how I would amend the section of VBA code below so it gives the dd-mm-yyyy format and also put brackets around the date so the file format would be 'Myfilename (dd-mm-yyyy).xlxs' e.g 'Myfilename (05-02-2018).xlxs'


    Please Login or Register  to view this content.
    tdate = Now()
    report_date = Day(tdate) & "-" & Month(tdate) & "-" & Year(tdate)
    Workbooks(wb_master).Activate
    report_name = "Weekly WBS Report " & " " & report_date & ".xlsx"
    SaveAsFileName = ActiveWorkbook.Path & "/" & report_name
    Please Login or Register  to view this content.

    Many thanks in advance for any assistance received


    Regards

    Rob
    Rob

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Amend VBA to add dd-mm-yyyy at end of file name as it show 5-2-2018 instead of 05-02-2

    Change to
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    474

    Re: Amend VBA to add dd-mm-yyyy at end of file name as it show 5-2-2018 instead of 05-02-2

    jindon,


    EXCELLENT !! Many thanks for your very prompt replay !!


    Regards

    Rob

+ 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. Call in the Cavalry - 2018
    By AliGW in forum The Water Cooler
    Replies: 152
    Last Post: 01-10-2019, 12:06 PM
  2. [SOLVED] Rank with Sub-Categories and Tie-Breaks (2018)
    By Median in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-26-2018, 02:31 PM
  3. how to sort Week no- Year (04-2018, 05-2019, 07-2018) in pivot chart.
    By sahana108 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2018, 09:07 AM
  4. Datepicker for 2018 formatting formula help
    By JohnGreen2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-29-2017, 12:34 PM
  5. employees hiliday planner 2018
    By fly2waleed in forum Excel General
    Replies: 1
    Last Post: 12-11-2017, 06:53 AM
  6. Fiscal Year 2018 ( Feb 4, 2017 - Feb 3, 2018)
    By chethan1333 in forum Excel General
    Replies: 1
    Last Post: 05-09-2017, 08:40 AM

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