+ Reply to Thread
Results 1 to 2 of 2

Saving a file by name,date and time

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2006
    Posts
    6

    Question Saving a file by name,date and time

    I am currently saving a test file in this format
    "TEST - Created August 31 06, 10 26-47 A.XLS"
    What I would Like to add is the persons name taking the test which is displayed in worksheet "test" cell Z3.

    So that the saved file would look something like this.
    "John doe - TEST - Created August 31 06, 10 26-47 A.XLS"


    Here it the code that I am currently using.


    I would appreciate any help, I have tried several different ways but no luck.
    Thanks in advance for any help.

    ActiveWorkbook.SaveCopyAs "C:\forms\TEST\TEST - Created " + Format(ActiveWorkbook.Worksheets("TEST").Cells(3, 1), " mmmm D yy, h mm-ss A/P") + ".XLS"

  2. #2
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    SaveFileWithName

    Tweak this:

    Sub SaveACopyWithName()
    Dim strDate As String
    Dim MyPath, MyName, Doe
    MyPath = Application.ActiveWorkbook.Path
    Count = Len(ActiveWorkbook.Name)
    Sheets("Test").Select
    Doe = Range("Z3")
    MyName = Left(ActiveWorkbook.Name, Count - 4)
    strDate = Format(Date, "yyyy-mm-dd") ' & " " & Format(Time, "hh-mm-ss")
    ActiveWorkbook.SaveCopyAs Filename:=MyPath & "\" & Doe & MyName & "-" & strDate & ".xls"
    End Sub

    In this case you can have the original file name not having the Date in it.

    Cheers, Gábor

+ 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