Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50235

Run-time error 1004/Save file macro

$
0
0
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

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

Viewing all articles
Browse latest Browse all 50235

Trending Articles