lks55
04-01-2016, 05:06 AM
Hi at all
I have to write a macro were I create a new workbook and then the user has to save it in a folder of his choice. I figured out that this code works:
Sub AddNew()
Dim s As Variant
Workbooks.Add
s = Application.GetSaveAsFilename("Excel Workbook", "Excel Files (*.xlsm), *.xlsm")
ActiveWorkbook.SaveAs "WK00 - UK Total"
End Sub
The thing is that I don't understand it. Workbooks.add creates the new file. The a path will be saved in 's'. But how does the next command knows that my active file has to be saved in the path s. I don't see a relation.
Best Regards
Lukas
I have to write a macro were I create a new workbook and then the user has to save it in a folder of his choice. I figured out that this code works:
Sub AddNew()
Dim s As Variant
Workbooks.Add
s = Application.GetSaveAsFilename("Excel Workbook", "Excel Files (*.xlsm), *.xlsm")
ActiveWorkbook.SaveAs "WK00 - UK Total"
End Sub
The thing is that I don't understand it. Workbooks.add creates the new file. The a path will be saved in 's'. But how does the next command knows that my active file has to be saved in the path s. I don't see a relation.
Best Regards
Lukas