Hi, I wonder if someone can help.
I am trying to get a piece of code save the current workbook as a derived filename, but the filename does not populate in the "File/Save As" window when i run the process. The filename displays in the msgbox just as I want it to. I've copied below an extract from the process. Can anyone help?
' Establish the Filename.
Filename = NurseryShort & " Salary " & wsEmployeeData.Range("PayrollMonth") & " Weekly v3.0"
MsgBox Filename
' Save the Workbook.
Do
MsgBox "Please save the Weekly Payroll file.", vbInformation, _
"Treetops Payroll"
' Assign the "Drive".
ChDrive "T"
' Establish This Year and Next Year.
ThisYear = Right(InputPayrollMonth, 2)
NextYear = ThisYear + 1
' Establish the Month Number.
PayrollMonthShort = Left(wsEmployeeData.Range("PayrollMonth"), 3)
PayrollMonthNumber = Application.WorksheetFunction.Index(wsWPTables.Range("MonthsNumber"), _
Application.WorksheetFunction.Match(PayrollMonthShort, wsWPTables.Range("MonthsShort"), 0))
' Establish the Long Month Name.
PayrollMonthLong = Application.WorksheetFunction.Index(wsWPTables.Range("MonthsLong"), _
Application.WorksheetFunction.Match(PayrollMonthShort, wsWPTables.Range("MonthsShort"), 0))
' Assign the Directory.
ChDir "T:\Accounts\Accounts Oct " & ThisYear & " - Sep " & NextYear & "\Salaries\" & PayrollMonthNumber & _
" " & PayrollMonthLong & " " & ThisYear & "\Issued"
' Save the File.
SaveFile = Application.GetSaveAsFilename(InitialFileName:=Filename, _
FileFilter:="Excel Files (*.XLSM), *.XLSM", _
Title:="Save As")
Loop Until SaveFile <> "False"
wbWeeklyPayroll.SaveAs Filename:=SaveFile
Bookmarks