Hello all,
I have a template that i need to "save as" based on the reporting date. It is not working for some reason. Can you please see where i have coded incorrectly.
Attached is the file and below is the code:
Sub WBKDUP()
Dim i As Integer
Dim fname As String, path As String
Dim reportdate As String
i = 6
path = ThisWorkbook.path
reportdate = Range("Current_Month")
Do While Sheets("control").Cells(i, 2).Value <> ""
fname = Sheets("control").Cells(i, 2).Value
Range("DC_NAME") = fname
Sheets("DirectConnect Summary").Cells(2, "f").Value = fname & " DirectConnect Summary Report"
ActiveWorkbook.SaveAs path & "\" & fname & " DirectConnect " & reportdate & " Report.xls"
i = i + 1
Loop
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
I have a template that i need to "save as" based on the reporting date. It is not working for some reason. Can you please see where i have coded incorrectly.
Attached is the file and below is the code:
Sub WBKDUP()
Dim i As Integer
Dim fname As String, path As String
Dim reportdate As String
i = 6
path = ThisWorkbook.path
reportdate = Range("Current_Month")
Do While Sheets("control").Cells(i, 2).Value <> ""
fname = Sheets("control").Cells(i, 2).Value
Range("DC_NAME") = fname
Sheets("DirectConnect Summary").Cells(2, "f").Value = fname & " DirectConnect Summary Report"
ActiveWorkbook.SaveAs path & "\" & fname & " DirectConnect " & reportdate & " Report.xls"
i = i + 1
Loop
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub