After you create a VBA macro in Outlook, how do you back it up, save a copy, or copy it to a new computer?
There are three ways to make a copy of your macros:
Method 1
Copy the contents of ThisOutlookSession (and any modules) and paste into notepad, saving the macro(s) as a text file.
Method 2
Right click on ThisOutlookSession and choose Export File. You'll need to do for each module (if any) in your Project.
Method 3
Close Outlook and locate the VBAProject file. Copy it to make a backup.
In Windows 7, 8, or Vista, paste %appdata%\microsoft\outlook in the address bar of Windows Explorer and press Enter to jump to the C:\Users\username\AppData\Roaming\Microsoft\Outlook folder where VBAProject.OTM is. Copy it to make a backup.
In Windows XP, paste %USERPROFILE%\Application Data\Microsoft\Outlook in the address bar of Windows Explorer and press Enter. This will open Windows Explorer to C:\Documents and Settings\username\Application Data\Microsoft\Outlook. Copy the VBAProject.OTM file.
Which method is better? It really depends on your needs. Copying the VBAProject.OTM file insures you have everything in the project and can drop it in the Outlook folder to restore the macros. Copying the code to a text file may be easier to share with others or to copy some macros to another computer that has Outlook macros already in use.
Looks like the copy OTM method finally dies - getting this new pop-up for the first time ever after all these years:
Office has identified a potential security concern Warning the digital signature has been tampered with.
Are you using signed macros? Was the otm you copied signed with the same digital signature as the one it replaced?
Yes to signed (with SelfCert). But the not the same cert as the destination was / is a new insider build. But this approach has always worked in the past -- I keep a copy of the OTM and move it into the folder on the new build and off we go.
Thank you Diane.
What is the name of the xml file and where will I find it?
Heather
it's "Outlook Customizations (olkexplorer).exportedUI" - you can save it anywhere for easy access, default location should be in documents.
I am having a similar problem in Outlook 2010, but in addition to the code I need to back up the icon assigned to the macro on my QAT. Anyone got ideas?
if you export the customizations, the icon you assigned to the button is included in the xml file that holds the customizations.
I have the same Problem. I lost all the changes i did on the project every time i restart my system.
Is there any way to avoid this problem without having to back up and reload all the modules?
I have made a tiny macro, what makes me sure to have all outlook vba code / macros saved. this save-macro I have defined as :
------------------------------------------------------------------------------
Private Sub Application_Quit()
Dim objFso As Object
Set objFso = CreateObject("Scripting.FileSystemObject")
Dim Quelldatei, Zieldatei
'locate the Directory where your VBAProject.otm file is located and write it to 'Quelldatei'
Quelldatei = "C:UsersusernameAppDataRoamingMicrosoftOutlook*.*"
'define the Destination where you want to have your macros saved and write it to 'Zieldatei'
Zieldatei = "C:__DatenOUTLOOKMakrosicherung" & Format(Now(), "YYYYMMDD hhmmss") & ""
objFso.createfolder (Zieldatei)
objFso.CopyFile Quelldatei, Zieldatei
End Sub
------------------------------------------------------------------------------
As result I have a Folder, containg all the necessary files für restoring my macros.
Instead of using the code in Application_Quit() you can also use it by 'manually' calling a macro of course.
Thanks!
You can trigger update of the modified date by changing a property through Windows Explorer. Right-click the file, select the third tabsheet (something like Change or modify, I am using dutch Windows where it is named "Aanpassen"). Add some dummy property, OK, and the file modified date is updated.
Hi again.
That's right. The date does not change (immediately). Eventually it does change and, yes the macros are saved and have all the changes after closing and restarting Outlook.
I am checking the last modified date and also used the F5 key to refresh the display. I just checked this again and the time does not change. For some reason there seems to be a delay somewhere.
That is weird - I can understand it not changing while Outlook is open but the date should update when Outlook is closed. (It really should update when you hit Save in the VBA Editor, but Outlook can be weird when it has a lock on a file.)
Hi. I have been making changes to my Outlook VBA project the last few days since Tues. Feb 26, 2013 but the VbaProject.OTM file show that it has not been changed since then. I save my changes and my project has all of the changes saved as viewed in the VBA editor in Outlook. Restarting Outlook and restarting my computer still shows the file as unchanged. I would like to make a backup copy of the project file but I am concerned if it's the correct file. Any comments or advice besides exporting all of the modules?
Regards Jim
So when you've restarted, the macros are still there but the file date and size on the OTM file at %appdata%\microsoft\outlook doesn't change? That is the correct path - make sure you are looking at the last modified date, not the created date.
I'm experiencing the same as James Dawson. I searched my computer both with the Windows 10 search and with "dir *.otm /ah /s" and can not find any newer VbaProject.OTM file, so it's not in a different location or hidden. Can it be that Microsoft changed the file altogether that stores OL macros?
No, there are atill using the otm file type and it is in %appdata%\microsoft\outlook
Thank you for reassuring me. I had copied the file there (from another computer), and when I asked the question, it still had the old "date modified". Since then, I quit Outlook, and the date got updated. Possibly it doesn't get actually saved when selecting File → Save VBAProject.OTM from the IDE.
possibly, or because it's locked while outlook is open, it doesn't get updated right off.