PDA

View Full Version : Solved: Renaming an opened workbook



prshnthvn
05-16-2010, 06:17 AM
Hello All,

Can we rename an opened workbook without saving it?
If I try to rename, I am getting an compile error and it says "can't assign to read-only property"
I am using the following code to rename the workbook.
ActiveWorkbook.Name = "dc.xls"
Is there any way to rename without saving the workbook?

Thanks,
Prashanth

mdmackillop
05-16-2010, 06:25 AM
You could SaveCopyAs which will leave your workbook open, but you cannot rename it.

Bob Phillips
05-16-2010, 09:08 AM
You could SaveCopyAs which will leave your workbook open, but you cannot rename it.

... and then Kill the old file.

GTO
05-16-2010, 09:58 AM
... and then Kill the old file.

As we started working against the activeworkbook, which is presumably not ThisWorkbook, if we SaveCopyAs and Kill the old file, didn't we just Kill the wb we are working against?

I was thinking that (again, presuming that the ActiveWorkbook <> ThisWorkbook) we might want to SaveAs, then kill the old, and continue to operate against the new/active.

Bob Phillips
05-16-2010, 02:30 PM
As we started working against the activeworkbook, which is presumably not ThisWorkbook, if we SaveCopyAs and Kill the old file, didn't we just Kill the wb we are working against?

I was thinking that (again, presuming that the ActiveWorkbook <> ThisWorkbook) we might want to SaveAs, then kill the old, and continue to operate against the new/active.

You are correct of course. I think it should be SaveAs if it is required to rename, then Kill will be fine.

GTO
05-16-2010, 06:43 PM
:fainted: Well... bound to happen every now and then:o:; look at who all I've been learning from :beerchug: