Consulting

Results 1 to 2 of 2

Thread: Saving file

  1. #1
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location

    Saving file

    I have this macro to save my file as the name "Cash report (today's date)." This file is supposed to save in the location G:\Fixed Income\Cash and Debit reports but for some reason it is not saving there. Does something look wrong to you in the below code??

    [VBA]Sub SaveCashreport()
    todaysdate = Application.InputBox("Enter Today's Date for File Name", "Today's Date")
    ChDir "G:\Fixed Income\Cash and Debit reports"

    ActiveWorkbook.Saveas Filename:="Cash report" + " " + "(" + todaysdate + ")" + ".xls", _
    FileFormat:=xlExcel8, CreateBackup:=False

    End Sub[/VBA]

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    [vba]
    Sub SaveCashreport()
    todaysdate = Application.InputBox("Enter Today's Date for File Name", "Today's Date")

    ActiveWorkbook.Saveas Filename:=""G:\Fixed Income\Cash and Debit reports"\Cash report" + " " + "(" + todaysdate + ")" + ".xls", _
    FileFormat:=xlExcel8, CreateBackup:=False

    End Sub [/vba]

    This assumes you enter today's date in an acceptable format (i.e. not with / in it)
    Be as you wish to seem

Posting Permissions

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