• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

How to backup and save your Outlook VBA macros

Slipstick Systems

› Developer › How to backup and save your Outlook VBA macros

Last reviewed on October 25, 2015     28 Comments

Applies to: Outlook (classic), Outlook 2007, Outlook 2010

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.

Export VBAPorject or modules to back them up

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.

How to backup and save your Outlook VBA macros was last modified: October 25th, 2015 by Diane Poremsky
Post Views: 71

Related Posts:

  • How to Backup your Outlook Account Settings
  • Outlook Backup and Dual-Boot File Locations
  • Use PowerShell or VBA to get Outlook folder creation date
  • Open multiple Outlook windows when Outlook starts

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Ragnar Moller says

    January 30, 2023 at 9:12 am

    Hi,

    Outlook crashes on me when I do Developer / Visual Basic, so none of the methods are useable. I suppose the VbaProjet.OTM is the source of the crash.

    How can I avoid this and save my code base ?

    Reply
    • Diane Poremsky says

      January 30, 2023 at 11:19 am

      The OLM is corrupt and unfortunately there is no method to repair it. Close Outlook and rename the OLM file at
      C:\Users\%username%\AppData\Roaming\Microsoft\Outlook to create a new one or, restore a backup if you have one.

      How extensive are the macros? You won't be able to get more than the module names and little bits of code from the olm file (opened in notepad). When mine was corrupted, it had a bunch of php scripts added to it for some reason. (They were scripts I wrote for another application.)

      I now try to remember to drag modules to a folder on my hard drive after editing - I sometimes forget but at least I will have something to work with if it gets corrupted again.

      Reply
      • Ragnar Moller says

        January 30, 2023 at 11:28 am

        Hi Diane,

        For me the file is not yet corrupt since Outlook reads it and partly executes the macro's
        am I wrong ?

        Maybe I just don't want to accept reality ...

        All of my code is VBA basically, no PHP scripts

      • Diane Poremsky says

        January 30, 2023 at 12:30 pm

        I think it is still corrupt. If you cant open the editor, there is no way to make a copy of the macros or edit it and there is no way to repair it.

        Is the size of the OLM file on your hard drive about what you'd expect for the number of macros? Obviously hard to know for sure - but mine was around 3MB when it went bad. I had problems with it before and it seemed to happen when the file approached 3MB.

        My current olm files is around 600 KB - 26 modules - some have macro just a few lines, other have 2 or 3 macros with 20 or 30 lines.

        Close Outlook, make a copy of the olm and open it in notepad. Eyeball it and see if there appears to be any code in it that doesn't belong.

  2. BobH says

    September 23, 2022 at 11:55 am

    Please disregard/delete last post - after explicitly saving the vbaproject.otm project on the source, the copy worked.

    Reply
  3. BobH says

    September 23, 2022 at 11:46 am

    I copied the vbaproject.otm file from one computer to another using the path you described. (for both source and destination). Windows File Explorer confirmed that it replaced what was there, but when I opened Outlook, none of the code changes in the source vbaproject.otm appeared. I know there are known problems with vbaproject.otm (such as time/date stamp never updating), but I have no clue on this one - will be forced to use module export/import.

    Reply
  4. Marek says

    April 21, 2022 at 1:44 pm

    Hi, I hope it is possible to write a macro that will go through all modules of the project and save each of them in *.bas format in a selected folder. I do not seem I can get such a simple logic in VBA. Could you help?

    Reply
    • Diane Poremsky says

      April 21, 2022 at 9:38 pm

      Outlook's VB object model doesn't support exporting the modules using code. You can drag them to File Explorer (its faster than using File > Save) - but need to do it one at a time.

      Reply
  5. Michael Houle says

    February 12, 2021 at 12:42 pm

    Based on this write up. We can transport the macro to another outlook instance. But the macro I wrote ends up with a button on the ribbon. Would that still need to be done manually?
    I'm looking to push this out to all of our computers. We already know we can do an export/import. We are trying to push this out silently with little to no user involvement.

    Reply
  6. TheDavidSlight says

    June 9, 2020 at 7:25 pm

    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.

    Reply
    • Diane Poremsky says

      June 9, 2020 at 10:28 pm

      Are you using signed macros? Was the otm you copied signed with the same digital signature as the one it replaced?

      Reply
      • TheDavidSlight says

        June 10, 2020 at 1:09 am

        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.

  7. Heather says

    August 6, 2015 at 3:12 am

    Thank you Diane.

    What is the name of the xml file and where will I find it?

    Heather

    Reply
    • Diane Poremsky says

      August 6, 2015 at 8:13 pm

      it's "Outlook Customizations (olkexplorer).exportedUI" - you can save it anywhere for easy access, default location should be in documents.

      Reply
  8. Heather says

    August 5, 2015 at 8:20 am

    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?

    Reply
    • Diane Poremsky says

      August 5, 2015 at 11:06 am

      if you export the customizations, the icon you assigned to the button is included in the xml file that holds the customizations.

      Reply
  9. Louq says

    October 27, 2014 at 8:30 am

    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?

    Reply
  10. wolfgang says

    July 13, 2014 at 4:50 am

    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.

    Reply
    • Diane Poremsky says

      July 13, 2014 at 11:49 pm

      Thanks!

      Reply
  11. Jan den Ouden says

    March 15, 2013 at 2:04 pm

    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.

    Reply
  12. James Dawson says

    March 5, 2013 at 5:51 am

    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.

    Reply
    • Diane Poremsky says

      March 5, 2013 at 7:42 am

      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.)

      Reply
  13. James Dawson says

    March 1, 2013 at 5:52 am

    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

    Reply
    • Diane Poremsky says

      March 1, 2013 at 8:30 am

      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.

      Reply
      • Micromegas says

        April 4, 2016 at 10:11 pm

        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?

      • Diane Poremsky says

        April 4, 2016 at 11:50 pm

        No, there are atill using the otm file type and it is in %appdata%\microsoft\outlook

      • Micromegas says

        April 8, 2016 at 6:15 pm

        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.

      • Diane Poremsky says

        April 8, 2016 at 10:21 pm

        possibly, or because it's locked while outlook is open, it doesn't get updated right off.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 5

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Sync Issues and Errors with Gmail and Yahoo accounts
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Sync Issues and Errors with Gmail and Yahoo accounts

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.