Renaming workbook on Excel startup

Renfro

New Member
Joined
Nov 9, 2020
Messages
1
Platform
  1. Windows
I am new to Excel and VBA (complete beginner) and I'd like to resolve an issue with workbook naming as a starting point to my learning more about Excel & VBA.

When I open Excel, the template "Book.xlt" creates a default starting workbook called Book1 (no file extension is shown in the title bar). However, if I use any add-ins (Tools > Add-ins) my startup workbook always becomes Book2, which keeps making me think that I have another unsaved workbook open somewhere. The only way to get Book1 to display as the starting workbook is to deselect all add-ins.

I wanted change this behavior so that the starting workbook when opening Excel is always Book1 regardless of whether any Add-ins are being used or not.

How can I use VBA to achieve this so that it behaves as close to the standard original behavior as possible without undue side-effects?

I tried coming up with a solution myself, but each attempt had an issue associated with it. Apparently the only way to rename an open workbook is to do a File Save, so I tried running a file save command when Excel opens (I found some code online) but doing that means having to put the 'dummy' file somewhere (and my VBA code refused to delete it on Excel shutdown) and once you've saved it, the current workbook displays as Book1.xls and not Book1, which causes problems when editing .xlt template files because they also end up displaying as xls files (which is confusing).

So I thought that rather than trying hit and miss approaches (which may not be the best methods and may have undesirable side-effects such as making xlt files look like xls files) I'd ask experienced users on here who would know of the pros and cons of different solutions and could suggest the best option.

Any and all advice is appreciated.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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