I am trying to use the Outlook 2016 command line switch "/altvba
" to start Outlook with its "VbaProject.OTM" macro file in a non-standard location instead of "%appdata%\Microsoft\Outlook", but it does NOT work. When I try to use it, I receive an error message that this switch is not valid.
Correct, you can start Outlook using the /altvba switch to use a different VBA project file... but before you use use the switch, you need to set a registry key to enable this capability.
To use this switch, open the Run command by pressing Windows key + R then type outlook /altvba and the path to the alternate VBA file. You'll need to use double quotes around the path if the path contains spaces. Examples:
outlook /altvba C:\Users\slipstick\AppData\Roaming\Microsoft\Outlook\New.OTM
outlook /altvba "C:\Users\slipstick\Documents\VbaProject.OTM"
The project name is visible in the VBA Editor, but not the full path to the file. Note: if you use VBAProject as the file name (but in a different path), you'll only see the project name, not the full path to the file.
Outlook 2016
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security DWORD: EnableAltVba Value: 1
Outlook 2013
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Security DWORD: EnableAltVba Value: 1
Outlook 2010
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security DWORD: EnableAltVba Value: 1
Do it for me
If you don't want to edit the registry, you can download and run the reg file for your version of Outlook.
Outlook 2016 Outlook 2013 Outlook 2010
I think there might be a very minor issue with the section:
"The project name is visible in the VBA Editor, but not the full path to the file. Note: if you use VBAProject as the file name (but in a different path), you'll only see the project name, not the full path to the file."
Testing with my Outlook 2010 I found that:
1) It never displays the full PATH. Only the file NAME.
2) It only displays the Project Name (if the file name is not "VBAProject.otm" and regardless of the location) until you do a Save in the editor. It then reverts to the file name.
This is an old post, but I still found it very useful. I can now load files I am developing, and leave my original in tact, great tip!
Hi,
Hoping you can help. The above worked well for me so thank you for that.
However, it doesn't appear to work fully the first time I run outlook using this. Although it will display the alternative project, only after closing and using the switch again will it actually RUN the code within it.
(my code sets a few things on application_startup, and appends to a text file when both sending and receiving an email)
This is also the case when I replace the file in the AppData/etc.../ folder manually, so isn't specific to using the switch. Just hoping you have some wisdom to help with my issue!
My fingers are crossed, hope you can help!
Thanks
Darren