ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook renaming (https://www.excelbanter.com/excel-programming/299937-workbook-renaming.html)

billyb

Workbook renaming
 
I want to rename a workbook as soon as it’s loaded. In th
ThisWorkBook_Open event I tried:

Workbook.Name = “MyName.xls”

but that doesn’t work because WorkBook’s Name property is read-only.
then used a SaveAs routine using the new name. That works because th
workbook then assumes the name used in SaveAs, but saving the fil
takes too long. How can I rename a workbook while it’s loaded othe
than doing a “SaveAs”?

Any help greatly appreciated

--
Message posted from http://www.ExcelForum.com


Chris

Workbook renaming
 
I think SaveAs is your only recourse: You can do a SaveAs, Then delete the old work book without letting the user know
Application.DisplayAlerts = Fals
Me.SaveAs "MyBook
Set FSO = CreateObject("Scripting.FileSystemObject"
FSO.DeleteFile ("OldBk.xls"
Application.DisplayAlerts = Tru

----- billyb wrote: ----

I want to rename a workbook as soon as its loaded. In th
ThisWorkBook_Open event I tried

Workbook.Name = €śMyName.xls€

but that doesnt work because WorkBooks Name property is read-only.
then used a SaveAs routine using the new name. That works because th
workbook then assumes the name used in SaveAs, but saving the fil
takes too long. How can I rename a workbook while its loaded othe
than doing a €śSaveAs€ť

Any help greatly appreciated


--
Message posted from http://www.ExcelForum.com



Nigel[_8_]

Workbook renaming
 
You could try this.......

Application.DisplayAlerts = False
Me.SaveAs "NewName"
Kill "OldName.xls"
Application.DisplayAlerts = True

Cheers
Nigel

"billyb " wrote in message
...
I want to rename a workbook as soon as it's loaded. In the
ThisWorkBook_Open event I tried:

Workbook.Name = "MyName.xls"

but that doesn't work because WorkBook's Name property is read-only. I
then used a SaveAs routine using the new name. That works because the
workbook then assumes the name used in SaveAs, but saving the file
takes too long. How can I rename a workbook while it's loaded other
than doing a "SaveAs"?

Any help greatly appreciated!


---
Message posted from http://www.ExcelForum.com/




billyb[_2_]

Workbook renaming
 
Many thanks for the reply, but I was hoping there was a workaround tha
would let me avoid SaveAs because it adds too much time to the proces
of opening the workbook. Guess I'm stuck with it though

--
Message posted from http://www.ExcelForum.com



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com