HI All,
I am trying to write some code to open an existing excel form, populate it, and save it with a custom filename in a directory that is built using variables I have declared.
The only part I am having difficulty with is setting the pathname. Here is my code:
The part in red is where the real problem is.
Thanks for the help
I am trying to write some code to open an existing excel form, populate it, and save it with a custom filename in a directory that is built using variables I have declared.
The only part I am having difficulty with is setting the pathname. Here is my code:
Code:
'Build path to save file to
spath = "S:\Contracts\Geomatics LAB\Signed\" & Company
'Build File name
Filename = "" & reservationNumberforForm & " " & Company & "-Payment Schedule"
'Save the payment schedule to the S: drive
'xlApp.ActiveWorkbook.SaveAs Filename:="S:\Contracts\Geomatics LAB\Signed\" & Filename, FileFormat:=xlOpenXMLWorkbook
xlApp.ActiveWorkbook.SaveAs Filename:=[COLOR="Red"]"" & spath & " [/COLOR]" & Filename, FileFormat:=xlOpenXMLWorkbook
xlApp.ActiveWorkbook.Saved = True
The part in red is where the real problem is.
Thanks for the help