Workbook renaming

  • Thread starter Thread starter billyb
  • Start date Start date
B

billyb

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
 
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 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
 
You could try this.......

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

Cheers
Nigel
 
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
 
Back
Top