Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I perform a file save as in the workbook but when I do this I the original
file is no longer open. This causes me to manully reopen the original file. I would like the original file to remain open even during or after the new workbook is created. Any ideas....thank you. My current code is below: ActiveWorkbook.SaveAs Filename:="WHLS Oversight Rpt " & Format(Date, "mmddyy") & ".xls", FileFormat:=xlExcel8, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.DisplayAlerts = True Application.ScreenUpdating = True ActiveWorkbook.Close End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the 'SaveCopyAs' method instead of 'SaveAs'.
If you're only interested in a single worksheet (or several sheets but not the entire workbook) being made into the new workbook, you can use the 'Copy' method on worksheets but don't use 'Paste' and you end up with a new workbook with just those sheets that becomes the active workbook. Steve Yandl "crmulle" wrote in message ... I perform a file save as in the workbook but when I do this I the original file is no longer open. This causes me to manully reopen the original file. I would like the original file to remain open even during or after the new workbook is created. Any ideas....thank you. My current code is below: ActiveWorkbook.SaveAs Filename:="WHLS Oversight Rpt " & Format(Date, "mmddyy") & ".xls", FileFormat:=xlExcel8, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.DisplayAlerts = True Application.ScreenUpdating = True ActiveWorkbook.Close End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steve,
I need to save the file with the new changes under a new name but also keep the old file open...does that make sense? "Steve Yandl" wrote: Use the 'SaveCopyAs' method instead of 'SaveAs'. If you're only interested in a single worksheet (or several sheets but not the entire workbook) being made into the new workbook, you can use the 'Copy' method on worksheets but don't use 'Paste' and you end up with a new workbook with just those sheets that becomes the active workbook. Steve Yandl "crmulle" wrote in message ... I perform a file save as in the workbook but when I do this I the original file is no longer open. This causes me to manully reopen the original file. I would like the original file to remain open even during or after the new workbook is created. Any ideas....thank you. My current code is below: ActiveWorkbook.SaveAs Filename:="WHLS Oversight Rpt " & Format(Date, "mmddyy") & ".xls", FileFormat:=xlExcel8, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.DisplayAlerts = True Application.ScreenUpdating = True ActiveWorkbook.Close End Sub . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That does make sense. Using SaveCopyAs will create a near exact duplicate
of your workbook and it will become the new active workbook. As I recall, you don't retain any VBA code stored in modules but you will get all your data, formatting and code attached to the workbook or individual worksheets. If you close that workbook (as opposed to closing Excel), your previous workbook should once again be the active workbook. I need to run a test but I think that you should be able to simply add a line of code to close the active workbook and the copy will be closed with the new name you gave it and your starting workbook should be active and ready to go again. Steve "crmulle" wrote in message ... Steve, I need to save the file with the new changes under a new name but also keep the old file open...does that make sense? "Steve Yandl" wrote: Use the 'SaveCopyAs' method instead of 'SaveAs'. If you're only interested in a single worksheet (or several sheets but not the entire workbook) being made into the new workbook, you can use the 'Copy' method on worksheets but don't use 'Paste' and you end up with a new workbook with just those sheets that becomes the active workbook. Steve Yandl "crmulle" wrote in message ... I perform a file save as in the workbook but when I do this I the original file is no longer open. This causes me to manully reopen the original file. I would like the original file to remain open even during or after the new workbook is created. Any ideas....thank you. My current code is below: ActiveWorkbook.SaveAs Filename:="WHLS Oversight Rpt " & Format(Date, "mmddyy") & ".xls", FileFormat:=xlExcel8, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.DisplayAlerts = True Application.ScreenUpdating = True ActiveWorkbook.Close End Sub . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a copy of something that should work for you. You can amend the
line with the array if you don't want to carry over Sheets one through three. '----------------------------------- Sub SaveWithoutMacro() Dim intOpens As Integer intOpens = Application.Workbooks.Count Worksheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy Set objNewBook = Application.Workbooks(intOpens + 1) objNewBook.Activate objNewBook.SaveAs Filename:="MyNewBook.xls", FileFormat:=xlExcel8 objNewBook.Close End Sub '----------------------------------- Steve Yandl "crmulle" wrote in message ... Steve, I need to save the file with the new changes under a new name but also keep the old file open...does that make sense? "Steve Yandl" wrote: Use the 'SaveCopyAs' method instead of 'SaveAs'. If you're only interested in a single worksheet (or several sheets but not the entire workbook) being made into the new workbook, you can use the 'Copy' method on worksheets but don't use 'Paste' and you end up with a new workbook with just those sheets that becomes the active workbook. Steve Yandl "crmulle" wrote in message ... I perform a file save as in the workbook but when I do this I the original file is no longer open. This causes me to manully reopen the original file. I would like the original file to remain open even during or after the new workbook is created. Any ideas....thank you. My current code is below: ActiveWorkbook.SaveAs Filename:="WHLS Oversight Rpt " & Format(Date, "mmddyy") & ".xls", FileFormat:=xlExcel8, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.DisplayAlerts = True Application.ScreenUpdating = True ActiveWorkbook.Close End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Background Processes in File Save versus File SaveAs | Excel Programming | |||
Changing file/open and file/saveas directories | Excel Programming | |||
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met | Excel Discussion (Misc queries) | |||
How can I make File-Save , File-SaveAs Menu disabled? | Excel Programming | |||
Saveas with name of another file | Excel Programming |