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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
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

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
If you have the edit toolbar displayed there is a button to comment blocks of code and one to uncomment.
 
Upvote 0
L

Legacy 96851

Guest
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,190,802
Messages
5,982,995
Members
439,811
Latest member
DB38

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
Top