Renaming the active workbook

L

Legacy 96851

Guest
Is there a way to use VBA to rename the currently open, active workbook? ActiveWorkbook.Name = "Etc.xls" doesn't work, Name being a read-only property.

That is to say, is there a way to do it without using save as to save it to the same directory under a different name.

Edit: oh also, this is completely unrelated, but not worth it's own thread. Is there a way to block comment in VBA without putting an apostrophe before every line?
 
Last edited by a moderator:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
For your edit question, select the block of code and go to the edit toolbar and there is a button to comment block of code.

Hope that helps.
 
Upvote 0
Edit: oh also, this is completely unrelated, but not worth it's own thread. Is there a way to block comment in VBA without putting an apostrophe before every line?

View > Toolbars > Edit. You can then select multiple lines of code and click the Comment Block button.
 
Upvote 0
If you have the edit toolbar displayed there is a button to comment blocks of code and one to uncomment.
 
Upvote 0
Sigh. I never check View, and it's always there. Thanks.

As for the main question, the more I think about it, the less possible it seems. Excel can't even do that without the macro context. Fine with me, these users can just deal with manually changing the name. I've already saved them days of work.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top