Free OST to PST Converter via Outlook VBA

Outlook uses two kinds of Outlook data files – OST file and PST file. In terms of OST file, it has many disadvantages. Thus you’d better convert your OST file to PST file. This article will teach you to make a free OST to PST converter via VBA.

If you are using an Exchange account in MS Outlook, all your items will be stored in an offline storage table file (OST) as a cache on your local hard drive. In this case, every time when you log in to your account, Outlook will start to sync and download the necessary items from the mail server to the local OST file. Although it is advantageous, it can become inaccessible in many situations.

For instance, if your Exchange server crashes for some reasons, you will be able to access the contents in the OST file. In this situation, you will be incapable of accessing your mailbox any more. Also, you’ll get various sync error messages. In addition, you can’t open an OST file without the according Exchange account. Furthermore, as we all know, Outlook offers users an inbuilt tool for repairing PST file. But there is no inbox fix utility for OST file. Therefore, in a nutshell, you had better convert your Outlook OST to PST file so that the data are always accessible.

Free OST to PST Converter via Outlook VBA

You can select to convert it via creating a new PST file and then copying all items in the OST file to the PST file manually. However, obviously, it’ll be a very tedious task. Therefore, here we will teach you to use Outlook VBA to create a free OST to PST converter.

Free OST to PST Converter via Outlook VBA

  1. In the first place, launch you Outlook application.
  2. Then press “Alt + F11” key buttons to open the Outlook VBA editor.
  3. In the next “Microsoft Visual Basic for Applications” window, open a module.
  4. Subsequently, copy the following VBA codes into this module window.
Private Sub ConvertOST2PST()
    Dim objSourceFileFolders As Outlook.Folders
    Dim objFolder As Outlook.Folder
    Dim objNewPSTFileFolder As Outlook.Folder
    'Create a PST file in your desired name and local folder
    Outlook.Application.Session.AddStoreEx "E:\PSTfromOST.pst", olStoreUnicode
    Set objNewPSTFileFolder = Session.Folders.GetLast()
    'Get all the folders of the source OST file
    'Change the exchange account to your own case
    Set objSourceFileFolders = Outlook.Application.Session.Folders("").Folders
    'Copy all the items and folders from the source OST to the new PST
    On Error Resume Next
    For Each objFolder In objSourceFileFolders
        objFolder.CopyTo objNewPSTFileFolder
End Sub

VBA Code - Free OST to PST Converter

  1. After that, click the “Run” icon in the toolbar and just press F5 key button.
  2. At once, the macro will be triggered.
  3. Eventually, you will see a new Outlook data file in the mail navigation pane, which contains the same items of the source PST file.

What If You Cannot Access OST File

For some reasons, such as Exchange server crashes or online account is disabled, you will be unable to access the contents of your OST file. In such cases, you have no choice but to use a preeminent and experienced OST tool like DataNumen Exchange Recovery. It can convert the OST file to PST file like a breeze.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql corruption and outlook repair software products. For more information visit

Leave a Reply

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