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.
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Watch MrExcel Video

Forum statistics

Threads
1,118,273
Messages
5,571,254
Members
412,374
Latest member
Nagelgal
Top