Saving Workbook to a Folder

  • Below is the code I currently have which will open workbooks Run my macro then save them into the same folder and go onto the next workbook.


    Code
    Sub DBSSReport()
    sFileName = Dir("P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Macro Ready\" & "*.xls")
    Do While sFileName <> ""
        Set Wkb = Workbooks.Open("P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Macro Ready\" & sFileName)
        Call MainBeast
    Wkb.Close (True)
    sFileName = Dir
    Loop
    End Sub



    What I need is to open a workbook from the above folder then save to a different folder with the path of P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Final
    Any Suggestions?

  • Re: Saving Workbook to a Folder


    Try (untested)
    [vba]Sub DBSSReport()
    sFileName = Dir("P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Macro Ready\" & "*.xls")
    Do While sFileName <> ""
    Set Wkb = Workbooks.Open("P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Macro Ready\" & sFileName)
    Call MainBeast
    Wkb.SaveAs "P:\SMARTeam\SMARTeam Files\Rankings\DBSS Files\Final\" & sFileName
    Wkb.Close False
    sFileName = Dir
    Loop
    End Sub[/vba]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!