ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro not saving as (https://www.excelbanter.com/excel-programming/442070-macro-not-saving.html)

JOSEPH WEBER

Macro not saving as
 
The following is code that I am using for a project. I want it to save as
based on a value that is in the source spreadsheet. It is supposed to open up
another spreadsheet and then save it as that value in the source spreadsheet.
the macro is stopping at the line where it needs to name the file, then save
it. can someone help?


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

joel[_941_]

Macro not saving as
 

remove the brackets from spath

from
ActiveWorkbook.SaveAs Filename:=[spath], _
to
ActiveWorkbook.SaveAs Filename:=spath, _


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=198807

http://www.thecodecage.com/forumz



All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com