View Single Post
  #2  
Old May 15th 17, 04:47 AM
Rachal Rachal is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2017
Posts: 1
Default

Hi, PamLnnle,

For that, you can write VBA codes to do that. Try below macro.

First, put all the pst files which you need to open into a same folder.

Then run this macro. Please note you need to change the folder path "E:\" into your real path in code "Call LoopFolders("E:\") "


Sub BatchOpenMultiplePSTFiles()

'You can change the path as per your needs
'You can also specify a folder other than a drive
'For instance - Call LoopFolders("C:\Users\Test\My Documents\Outlook Files")
Call LoopFolders("E:\")
MsgBox "Open Successfully!", vbExclamation + vbOKOnly, "Open Outlook Data File"

End Sub

Sub LoopFolders(strPath As String)
Dim objFileSystem As Object
Dim objFolder As Object
Dim objFile As Object
Dim objPSTFile As Object

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFileSystem.GetFolder(strPath)

For Each objFile In objFolder.Files
'Find the pst file by file extension
strFileExtension = objFileSystem.GetExtensionName(objFile)
If LCase(strFileExtension) = "pst" Then
Set objPSTFile = objFile
'Open the PST file
Outlook.Application.Session.AddStore (objPSTFile.Path)
End If
Next

'Process all folders and subfolders in the Local Drive E
If objFolder.SubFolders.Count 0 Then
For Each objSubFolder In objFolder.SubFolders
'Skip the system and hidden folders
If ((objSubFolder.Attributes And 2) = 0) And ((objSubFolder.Attributes And 4) = 0) Then
LoopFolders (objSubFolder.Path)
End If
Next
End If
End Sub

And I also attach th link of the codes he

https://www.datanumen.com/blogs/batc...files-outlook/

Hope it helps.

Last edited by Rachal : May 22nd 17 at 10:24 AM.
Ads