E
ehale
Hello,
I'm having a problem with SAVEAS in following code. Basically trying to Add
a new Workbook (wb2) so that I can move sheets to it from an existing
workbook (wb1). When running, I get the dialogue box asking me to save as in
the correct directory, and it seems to save, but at the end of the routine
the file doesn't exist in the directory. When I step through the code, I can
see at the point right after I get the SaveAs Dialogue box (wb2.SaveAs
ChosenFileName, xlWorkbookNormal) that the workbook still has it's original
default name assigned by the Workbooks.Add command (Book1.xls, or whatever it
is). Not sure how to troubleshoot this . . . I don't get any error.
Any help is very appreciated. Thanks in advance.
Dim CurrentPath As String
Dim Filename As Variant
'Store the current path
CurrentPath = CurDir
'Change the path to the one we want
SetCurrentDirectory "\\SRV1\RATER\Attach PIC Rater"
'setting activeworkbook (self-rater) as wb1
Set wb1 = ActiveWorkbook
wb1Name = ActiveWorkbook.Name
'Adding a new workbook to move Quote tab to
Dim wb2 As Workbook
Set wb2 = Workbooks.Add
tamfile = InputBox("Enter your Prospect Code", "Save As Prospect Code",
wb1Name)
ChosenFileName = Application.GetSaveAsFilename(tamfile, "Excel Files
(*.xls),*.xls,", , "Title")
wb2.SaveAs ChosenFileName, xlWorkbookNormal
I'm having a problem with SAVEAS in following code. Basically trying to Add
a new Workbook (wb2) so that I can move sheets to it from an existing
workbook (wb1). When running, I get the dialogue box asking me to save as in
the correct directory, and it seems to save, but at the end of the routine
the file doesn't exist in the directory. When I step through the code, I can
see at the point right after I get the SaveAs Dialogue box (wb2.SaveAs
ChosenFileName, xlWorkbookNormal) that the workbook still has it's original
default name assigned by the Workbooks.Add command (Book1.xls, or whatever it
is). Not sure how to troubleshoot this . . . I don't get any error.
Any help is very appreciated. Thanks in advance.
Dim CurrentPath As String
Dim Filename As Variant
'Store the current path
CurrentPath = CurDir
'Change the path to the one we want
SetCurrentDirectory "\\SRV1\RATER\Attach PIC Rater"
'setting activeworkbook (self-rater) as wb1
Set wb1 = ActiveWorkbook
wb1Name = ActiveWorkbook.Name
'Adding a new workbook to move Quote tab to
Dim wb2 As Workbook
Set wb2 = Workbooks.Add
tamfile = InputBox("Enter your Prospect Code", "Save As Prospect Code",
wb1Name)
ChosenFileName = Application.GetSaveAsFilename(tamfile, "Excel Files
(*.xls),*.xls,", , "Title")
wb2.SaveAs ChosenFileName, xlWorkbookNormal