#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default File SaveAs

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default File SaveAs

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default File SaveAs

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default File SaveAs

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default File SaveAs

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Background Processes in File Save versus File SaveAs Paige Excel Programming 2 April 24th 08 11:57 PM
Changing file/open and file/saveas directories jamjam Excel Programming 1 November 30th 07 04:48 PM
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met JMay Excel Discussion (Misc queries) 2 June 17th 07 04:37 PM
How can I make File-Save , File-SaveAs Menu disabled? Zoo Excel Programming 4 June 5th 06 06:58 AM
Saveas with name of another file sowetoddid[_19_] Excel Programming 15 June 11th 04 04:53 PM


All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"