I am trying to set up a macro in a template that when run will set the filename and file path and save as a macro enabled document. What I need to include in the filename is text from C7 and the date from C9 e.g. 4 June 2013
Have used the following code
Sub SaveBook()
sFile = Range("C7").Value & Range("C9") & ".xlsm"
ActiveWorkbook.Saveas Filename:="C:\Users\Lesley\Documents\" & sFile, FileFormat:=52
End Sub
When I run the macro I get the following error (the second line as highlighted above seems to be the issue).
Run-time error 1004
The file could not be accessed. Try one of the following
I hope this all makes sense, because I am very much a noob when it comes to vba
Thanks
Bookmarks