+ Reply to Thread
Results 1 to 2 of 2

saving file name with the date

  1. #1
    Baha
    Guest

    saving file name with the date

    Hi,
    I tried to check on previous post but could find relavent answer.
    I wanna write a code as follows
    Dim docn As Date

    Dim fn
    'docn = "abi"
    'Sheet1.Range("d2").NumberFormat = "[$-409]d-mmm;@"

    docn = Format(Date, "[$-409]d-mmm;@")

    docn = Sheet1.Range("d2")

    'fn = "C:\Documents and Settings\My Documents\" & docn
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Documents and Settings\Packard Bell\My Documents\" & docn &
    ".txt", FileFormat:= _
    xlText, ReadOnlyRecommended:=False, CreateBackup:=False

    but why that file cannot be saved like file name= 25 March
    thanks for your help

    --
    Regards,
    Baha

  2. #2
    Edwin Niemoller
    Guest

    Re: saving file name with the date

    Try using the worksheetfunction TEXT

    Like so

    orderDate =
    WorksheetFunction.Text(Worksheets("input").Range("orderDate").Value,
    "DD-MMM-YYYY")
    orderFile = facHisDir & invoiceNumber & "_" & facHisReg & "_" & orderDate &
    ".xls"

    Cheers

    Edwin



    "Baha" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > I tried to check on previous post but could find relavent answer.
    > I wanna write a code as follows
    > Dim docn As Date
    >
    > Dim fn
    > 'docn = "abi"
    > 'Sheet1.Range("d2").NumberFormat = "[$-409]d-mmm;@"
    >
    > docn = Format(Date, "[$-409]d-mmm;@")
    >
    > docn = Sheet1.Range("d2")
    >
    > 'fn = "C:\Documents and Settings\My Documents\" & docn
    > ActiveWorkbook.SaveAs Filename:= _
    > "C:\Documents and Settings\Packard Bell\My Documents\" & docn &
    > ".txt", FileFormat:= _
    > xlText, ReadOnlyRecommended:=False, CreateBackup:=False
    >
    > but why that file cannot be saved like file name= 25 March
    > thanks for your help
    >
    > --
    > Regards,
    > Baha




+ 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