B
bigjim
I am using Excel 2003. I have a workbook named Main.xls I have a
worksheet in Main.xls named Ticket Cell j8 of Ticket contains a
ticket number such as NT0104, Cell b8 in ticket contains a co. name such
as Exxon, and cell b200 in ticket contains a dir path such as
c:\2009\Feb\ . I want to save the workbook main.xls to the new name
(in this case NT0104Exxon.xls) to the specified dir path (in this case
c:\2009\Feb) and then I want to keep the original workbook, Main.xls open.
When I run the following code, it saves NT0104Exxon.xls to My documents
instead of to c:\2009\Feb and then it closes the workbook. I would
appreciate any help on what I am doing wrong.
Here's the code:
rem sitting up variable that will determine where the files will be saved.
Dim strappend As String
Dim strpath As String
Dim str3 As String
Sheets("ticket").Select
strappend = ActiveSheet.Range("j8").Value
strpath = ActiveSheet.Range("b200").Value
str3 = ActiveSheet.Range("c8").Value
Rem Setting fsavename to directory and file
fsavename = strpth & strappend & str3 & ".xls"
Rem Saving the file fsavename to the designated directory
ThisWorkbook.SaveAs Filename:=fsavename
Rem this keeps the main workbook open
ActiveWorkbook.Close False
end sub
Thanks in advance for the help
worksheet in Main.xls named Ticket Cell j8 of Ticket contains a
ticket number such as NT0104, Cell b8 in ticket contains a co. name such
as Exxon, and cell b200 in ticket contains a dir path such as
c:\2009\Feb\ . I want to save the workbook main.xls to the new name
(in this case NT0104Exxon.xls) to the specified dir path (in this case
c:\2009\Feb) and then I want to keep the original workbook, Main.xls open.
When I run the following code, it saves NT0104Exxon.xls to My documents
instead of to c:\2009\Feb and then it closes the workbook. I would
appreciate any help on what I am doing wrong.
Here's the code:
rem sitting up variable that will determine where the files will be saved.
Dim strappend As String
Dim strpath As String
Dim str3 As String
Sheets("ticket").Select
strappend = ActiveSheet.Range("j8").Value
strpath = ActiveSheet.Range("b200").Value
str3 = ActiveSheet.Range("c8").Value
Rem Setting fsavename to directory and file
fsavename = strpth & strappend & str3 & ".xls"
Rem Saving the file fsavename to the designated directory
ThisWorkbook.SaveAs Filename:=fsavename
Rem this keeps the main workbook open
ActiveWorkbook.Close False
end sub
Thanks in advance for the help