+ Reply to Thread
Results 1 to 3 of 3

add date+given text in the file name

Hybrid View

  1. #1
    Registered User
    Join Date
    09-12-2008
    Location
    Geneva, Switzerland
    Posts
    7

    add date+given text in the file name

    Hello,

    I would like to save a workbook (bigfile1.xls) with "_values only_ddmmmyyyy" text added to the name. (=the result should be a workbook called bigfile1_values only_ddmmmyyyy.xls)
    I have the date in dd-mmm-yyyy format in sheet 'header', cell BK3 of workbook bigfile.xls.

    What is the syntax for diong this please, added to the below?

    ActiveWorkbook.SaveAs Filename:= _
    "C:\....path\bigfile1.xls" _
    , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=True, CreateBackup:=False

    Thank you!
    Dora

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Thumbs down

    You can try with:
    myText = "_values only_"
    myDate = Format(Range("bk3"),"ddmmmyyyy")
    ActiveWorkbook.SaveAs Filename:= _
       "C:\....path\bigfile1" & myText & myDate &".xls"
    Regards,
    Antonio

  3. #3
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113
    Hi Dora C,

    Or this
    ActiveWorkbook.SaveAs Filename:= _
    "C:\....path\bigfile1_values only_" & Format(Now, "yyyy_mm_dd - hh mm"), FileFormat:=xlNormal, _
    Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=True, CreateBackup:=False
    And I think you don.t need this part
    , _
    Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=True, CreateBackup:=False

+ 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. Code to Export Excel Data to Text File
    By ashkash in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-13-2012, 05:59 AM
  2. Macro to import a flat file using 'text to columns'
    By miniweld in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2008, 04:37 AM
  3. Text File for creating report
    By hsmeet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2008, 09:51 PM
  4. looping issues
    By Marcus Gee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2007, 11:42 PM
  5. Replies: 5
    Last Post: 11-04-2006, 02:58 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