• save file as….

    Author
    Topic
    #464000

    strPath = ThisWorkbook.Path & “”
    Set v1 = ThisWorkbook
    Set w1 = v1.Worksheets(“Summary”)
    strDate = w1.Range(“B2”)

    ‘How can I save v1 in strPath named strDate formatted to dd.mm.yy ?

    Viewing 1 reply thread
    Author
    Replies
    • #1186297


      strDate = Format(w1.Range(“B2”), “dd.mm.yy”)
      v1.SaveAs strPath & strDate & “.xls”

      But I’d recommend using a different date format. Although points are allowed in file names, they can be confusing since the point is also used to separate the file name and extension. I’d use a format such as yyyymmdd – this makes it easy to sort the files.

    • #1186307

      Thanks Hans, for both the help and advice. There are occasions where the file will already exist, so how can I automatically overwrite the existing file without being prompted?

      I should know this, but I can’t find reference to it anywhere.

      • #1186308

        Insert a line

        Application.DisplayAlerts = False

        above the line with SaveAs, and

        Application.DisplayAlerts = True

        below it. See DisplayAlerts Property.

        • #1186310

          Yuck – the Lounge software seems to “correct” upper case use in a sentence and within a word automatically, without warning. The “a” in alert in Displayalert should be an A.

    Viewing 1 reply thread
    Reply To: save file as….

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: