+ Reply to Thread
Results 1 to 3 of 3

Save As VBA

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196

    Save As VBA

    Greetings,

    The code below works fine. Cell B1 is a date created by a the formula =today()

    Sub test()
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs Range("B1")
    ActiveWorkbook.Close
    End Sub

    When I run the macro it works, and saves the file, but it saves it as the numerical value for the date, and now the actual date.

    How do I write in a format so that the true date appears in the saved file name.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    11-16-2004
    Posts
    282

    Use the Format function to coerce values

    Hi EMoe!

    Use the Format function to coerce values to the format you need like this (replace my format to what you want it to look like):

    ActiveWorkbook.SaveAs Format(Range("B1"), "yyyy_mm_dd")

    Hope this helps,
    theDude

  3. #3
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196
    Thanks the Dude,

    that addition did the trick.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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