Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default SaveAs without closing original workbook

Hi All,

I want to clone a workbook in several copies with different file names, and
also I want to keep the original workbook open during the process and
activate it again at the end of the process. SaveAs works, but closes the
original.

Thanks,
Stefi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default SaveAs without closing original workbook

I forgot to mention that the workbook to be cloned contains the cloning Sub,
so Thisworkbook is to be cloned!

Stefio


Stefi ezt *rta:

Hi All,

I want to clone a workbook in several copies with different file names, and
also I want to keep the original workbook open during the process and
activate it again at the end of the process. SaveAs works, but closes the
original.

Thanks,
Stefi

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default SaveAs without closing original workbook

Adapt something like the following, if testing in a new wb first run Sub
origName()

Sub origName()
ThisWorkbook.SaveAs "TestOrig.xls"
End Sub

Sub test()
Dim sPath As String
Dim bKeepOpen
Const cOrigName As String = "TestOrig.xls" ' << change to the default name

bKeepOpen = True

If ThisWorkbook.Name = cOrigName Then
ThisWorkbook.Save
sPath = ThisWorkbook.Path & "\" & _
Replace(ThisWorkbook.Name, ".xls", "", , , vbTextCompare) & "_"
Application.DisplayAlerts = False
For i = 1 To 3
ThisWorkbook.SaveAs sPath & MonthName(i, True) & ".xls"
Next
ThisWorkbook.SaveAs cOrigName

If bKeepOpen Then
For i = 1 To 3
Workbooks.Open sPath & MonthName(i, True) & ".xls"
Next
End If

End If
Application.DisplayAlerts = True
End Sub

Save with as many names as you need, then re-save with the original name,
optionally reopen the others.

Regards,
Peter T


"Stefi" wrote in message
...
I forgot to mention that the workbook to be cloned contains the cloning

Sub,
so Thisworkbook is to be cloned!

Stefio


"Stefi" ezt rta:

Hi All,

I want to clone a workbook in several copies with different file names,

and
also I want to keep the original workbook open during the process and
activate it again at the end of the process. SaveAs works, but closes

the
original.

Thanks,
Stefi



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default SaveAs without closing original workbook

Thanks Peter, I'll test it tomorrow!
Stefi


Peter T ezt *rta:

Adapt something like the following, if testing in a new wb first run Sub
origName()

Sub origName()
ThisWorkbook.SaveAs "TestOrig.xls"
End Sub

Sub test()
Dim sPath As String
Dim bKeepOpen
Const cOrigName As String = "TestOrig.xls" ' << change to the default name

bKeepOpen = True

If ThisWorkbook.Name = cOrigName Then
ThisWorkbook.Save
sPath = ThisWorkbook.Path & "\" & _
Replace(ThisWorkbook.Name, ".xls", "", , , vbTextCompare) & "_"
Application.DisplayAlerts = False
For i = 1 To 3
ThisWorkbook.SaveAs sPath & MonthName(i, True) & ".xls"
Next
ThisWorkbook.SaveAs cOrigName

If bKeepOpen Then
For i = 1 To 3
Workbooks.Open sPath & MonthName(i, True) & ".xls"
Next
End If

End If
Application.DisplayAlerts = True
End Sub

Save with as many names as you need, then re-save with the original name,
optionally reopen the others.

Regards,
Peter T


"Stefi" wrote in message
...
I forgot to mention that the workbook to be cloned contains the cloning

Sub,
so Thisworkbook is to be cloned!

Stefio


"Stefi" ezt *rta:

Hi All,

I want to clone a workbook in several copies with different file names,

and
also I want to keep the original workbook open during the process and
activate it again at the end of the process. SaveAs works, but closes

the
original.

Thanks,
Stefi




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default SaveAs without closing original workbook

Use SaveCopyAs

See the VBA help

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Stefi" wrote in message ...
Thanks Peter, I'll test it tomorrow!
Stefi


Peter T ezt *rta:

Adapt something like the following, if testing in a new wb first run Sub
origName()

Sub origName()
ThisWorkbook.SaveAs "TestOrig.xls"
End Sub

Sub test()
Dim sPath As String
Dim bKeepOpen
Const cOrigName As String = "TestOrig.xls" ' << change to the default name

bKeepOpen = True

If ThisWorkbook.Name = cOrigName Then
ThisWorkbook.Save
sPath = ThisWorkbook.Path & "\" & _
Replace(ThisWorkbook.Name, ".xls", "", , , vbTextCompare) & "_"
Application.DisplayAlerts = False
For i = 1 To 3
ThisWorkbook.SaveAs sPath & MonthName(i, True) & ".xls"
Next
ThisWorkbook.SaveAs cOrigName

If bKeepOpen Then
For i = 1 To 3
Workbooks.Open sPath & MonthName(i, True) & ".xls"
Next
End If

End If
Application.DisplayAlerts = True
End Sub

Save with as many names as you need, then re-save with the original name,
optionally reopen the others.

Regards,
Peter T


"Stefi" wrote in message
...
I forgot to mention that the workbook to be cloned contains the cloning

Sub,
so Thisworkbook is to be cloned!

Stefio


"Stefi" ezt *rta:

Hi All,

I want to clone a workbook in several copies with different file names,

and
also I want to keep the original workbook open during the process and
activate it again at the end of the process. SaveAs works, but closes

the
original.

Thanks,
Stefi







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default SaveAs without closing original workbook

Much better, I didn't think of that!

Regards,
Peter T

"Ron de Bruin" wrote in message
...
Use SaveCopyAs

See the VBA help

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Stefi" wrote in message

...
Thanks Peter, I'll test it tomorrow!
Stefi


"Peter T" ezt rta:

Adapt something like the following, if testing in a new wb first run

Sub
origName()

Sub origName()
ThisWorkbook.SaveAs "TestOrig.xls"
End Sub

Sub test()
Dim sPath As String
Dim bKeepOpen
Const cOrigName As String = "TestOrig.xls" ' << change to the default

name

bKeepOpen = True

If ThisWorkbook.Name = cOrigName Then
ThisWorkbook.Save
sPath = ThisWorkbook.Path & "\" & _
Replace(ThisWorkbook.Name, ".xls", "", , , vbTextCompare) & "_"
Application.DisplayAlerts = False
For i = 1 To 3
ThisWorkbook.SaveAs sPath & MonthName(i, True) & ".xls"
Next
ThisWorkbook.SaveAs cOrigName

If bKeepOpen Then
For i = 1 To 3
Workbooks.Open sPath & MonthName(i, True) & ".xls"
Next
End If

End If
Application.DisplayAlerts = True
End Sub

Save with as many names as you need, then re-save with the original

name,
optionally reopen the others.

Regards,
Peter T


"Stefi" wrote in message
...
I forgot to mention that the workbook to be cloned contains the

cloning
Sub,
so Thisworkbook is to be cloned!

Stefio


"Stefi" ezt rta:

Hi All,

I want to clone a workbook in several copies with different file

names,
and
also I want to keep the original workbook open during the process

and
activate it again at the end of the process. SaveAs works, but

closes
the
original.

Thanks,
Stefi







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default SaveAs without closing original workbook

Thanks Ron and Peter! Peter's solution works, but Ron's one is really much
nicer!
Stefi


Peter T ezt *rta:

Much better, I didn't think of that!

Regards,
Peter T

"Ron de Bruin" wrote in message
...
Use SaveCopyAs

See the VBA help

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Stefi" wrote in message

...
Thanks Peter, I'll test it tomorrow!
Stefi


"Peter T" ezt *rta:

Adapt something like the following, if testing in a new wb first run

Sub
origName()

Sub origName()
ThisWorkbook.SaveAs "TestOrig.xls"
End Sub

Sub test()
Dim sPath As String
Dim bKeepOpen
Const cOrigName As String = "TestOrig.xls" ' << change to the default

name

bKeepOpen = True

If ThisWorkbook.Name = cOrigName Then
ThisWorkbook.Save
sPath = ThisWorkbook.Path & "\" & _
Replace(ThisWorkbook.Name, ".xls", "", , , vbTextCompare) & "_"
Application.DisplayAlerts = False
For i = 1 To 3
ThisWorkbook.SaveAs sPath & MonthName(i, True) & ".xls"
Next
ThisWorkbook.SaveAs cOrigName

If bKeepOpen Then
For i = 1 To 3
Workbooks.Open sPath & MonthName(i, True) & ".xls"
Next
End If

End If
Application.DisplayAlerts = True
End Sub

Save with as many names as you need, then re-save with the original

name,
optionally reopen the others.

Regards,
Peter T


"Stefi" wrote in message
...
I forgot to mention that the workbook to be cloned contains the

cloning
Sub,
so Thisworkbook is to be cloned!

Stefio


"Stefi" ezt *rta:

Hi All,

I want to clone a workbook in several copies with different file

names,
and
also I want to keep the original workbook open during the process

and
activate it again at the end of the process. SaveAs works, but

closes
the
original.

Thanks,
Stefi








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
SaveAs closing file without firing event WorkBook_beforeclose PFS Excel Programming 1 November 2nd 06 10:49 PM
copying worksheets to a new workbook without formulae referencing original workbook [email protected] Excel Programming 2 October 16th 06 07:31 PM
Keep original wkbk open after SaveAs? Ed Excel Programming 2 May 2nd 05 10:12 PM
Copy file and closing original Rob Excel Programming 3 May 8th 04 01:37 PM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 10:58 PM.

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"