Workbook renaming

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
 
G

Guest

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
 
N

Nigel

You could try this.......

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

Cheers
Nigel
 
B

billyb

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top