Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: SaveAs with cell as a date

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub save_itas3()
    fname = Application.GetSaveAsFilename _
    (InitialFilename:=Range("a1") & " " & WorksheetFunction.Substitute(Date, "/", "_"), _
    FileFilter:="Excel Files (*.xls),*.xls", FilterIndex:=0, Title:="Save As")
    If fname <> "False" Then
    ActiveWorkbook.SaveAs Filename:=fname
    End If
    End Sub
    Can someone break this down for me? I am looking for something similar, yet simpler.
    More along these lines, with the cell A1 containing a date of 2002/02/25:

    Public Sub SaveAsA1()
    ThisFile = Range("A1").Value
    ActiveWorkbook.SaveAs FileName:="C:data" & ThisFile
    End Sub

  2. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The following may be problemtatic as Excel doesn't like to save files with "/".

    ThisFile = Range("A1").Value

    Therefore, something like:

    thisfile = WorksheetFunction.Substitute(range("a1"), "/", "_")

    may be more appropriate, where Excel replaces / with _ with the Substitute function (works the same as the worksheet function (e.g., =subsitute(a1,"/","_"))

    Cheers, Nate

    P.S. - How about that game yesterday?

    [ This Message was edited by: NateO on 2002-02-25 09:05 ]

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks very much...works!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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