Macro to save a workbook

J

JOSEPH WEBER

I have the following code and it doesn't save as it is supposed to. Am I
missing something? I can't seem to figure it out. Thanks.

Sub Upload()
Application.EnableCancelKey = xlDisabled
Sheets("Upload").Select

lastRow = Range("M10000").End(xlUp).Row

Range("M" & lastRow).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "END"


Call Copy_GL


Q = Range("n1")


Call VoucherNum





Range("a1:n1000").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste

'Application.Goto referenece:="gl_acct"
'ActiveCell.Offset(0, 1).Range("a1").Select
'ActiveCell.ClearContents
Rows("1:1").Select
Selection.Delete Shift:=xlUp

spath = "P:\Platinum\A_P IMPORT\Contractor Invoices\" & Q

ActiveWorkbook.SaveAs Filename:=[spath], _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


ActiveWindow.Close
'windows("xxxxxxx").activate
Range("a3:m1000").ClearContents
Call name_fields









End Sub
 
S

SteAXA

you mustn't use square brackets for declare Filename, that is

ActiveWorkbook.SaveAs Filename:=spath, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top