Sometimes I blog things mostly so I can remember them and in the off chance that they might be useful to others. This post falls into that category. If you use Microsoft Excel, and you have a macro that you want to be available globally–in any open workbook–you can place it in your Personal Macro Workbook, which is just an Excel Workbook (in binary, XLSB, format, for speed) that lives at a particular location, where Excel will look for it whenever it launches.
On Windows 7, it lives here: 1
On Windows XP, it lives here:
C:\Documents and Settings\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLSB
In either case, the easy way to create PERSONAL.XLSB is not to muck around with the file system directly. Instead, just record a macro in Excel and, when you’re prompted to save it, choose Personal Macro Workbook from the Store Macro In drop-down menu on the Record Macro dialog box. Record yourself typing a few numbers and adding some formatting to them or something similar. Afterwards, you can open up the Personal Macro Workbook via the Visual Basic button on the Developer tab later and delete whatever you record. Once you create it, your Personal Macro Workbook will be listed in the VBA Editor as “VBAProject (PERSONAL.XLSB)”.
Some Additional Details for the Truly Nerdy
The location of the Personal Macro Workbook is a little confusing, because older versions of Excel stored it in an XLSTART folder buried inside the Program Files folder. Even though you can’t write any files to it, Excel 2007 and Excel 2010 also have XLSTART folders inside the Program Files directory. Here are the paths:
For Excel 2010:
C:\Program Files\Microsoft Office\Office14\XLSTART\
For Excel 2007:
C:\Program Files\Microsoft Office\Office12\XLSTART\
“Office 14″ is the internal name for Office 2010. It’s actually the 13th version of Office, but Microsoft saw fit to skip naming it Office 13, due, one suspects to superstition. So “Office 12″ is Office 2007, “Office 11″ is Office 2003, and so on. If you happen to be stuck running Excel 2003 on a Windows XP box, you’ll find PERSONAL.XLSB at this path:
C:\Program Files\Microsoft Office\Office11\XLSTART\
- If there’s no Roaming directory in your setup, use Local instead. The rest of the path will remain the same.
I have got XLSTART folder at two paths on my PC (m using Excel 2010):
1) C:\Documents and Settings\suneetaro\Application Data\Microsoft\Excel\XLSTART
2) C:\Program Files\Microsoft Office\Office14\XLSTART
Both don’t have PERSONAL.XLSB (not even hidden), but I had created a macro with ‘All open workbooks’ option selected for ‘Macros in’ dropdown ! Where the macro got stored then ?
Also, you can use the enviromental variable %APPDATA% to get the base of the folder – for instance the path “%APPDATA%\Microsoft\Excel\XLSTART\” would reach the correct folder in most cases. If not, try replacing %APPDATA% with %LOCALAPPDATA%. For instance, just typing %appdata% at the start prompt opens the explorer at Documents and settings/username/application data”. Handy!
Regarding the startpath where the Excel Personal Macro Workbook is located. This location can be installed in several different locations on the PC or company network. The best advice for your readers (like me) is explained on Ron de Bruin’s website: http://www.rondebruin.nl/personal.htm
1) Open excel
2) Hit alt-F11 to get to the VBE
3) Hit ctrl-g to see the immediate window and type this:
5) Press enter
You’ll see the startup path returned for the PC.