A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

open some pst files at once in outlook


« Outlook calendar | - »

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 10th 17, 07:07 AM
PamLnnle PamLnnle is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2017
Posts: 1
Default open some pst files at once in outlook

Hello,

I need to open several pst file in my outlook to compare some relevant emails in them.

I find that I can only open one pst file every time by using "Open Outlook Data File” button. So I need to open them one by one .

Can I have a button to open several pst files at once in outlook ? Thank you.
Ads
  #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.
 



« Previous Thread | - »

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook set to look for offline files--will not open Mr. Coffee Outlook - Installation 1 April 6th 08 07:09 PM
Why can't I open .jpg files in Outlook. Darcy F Outlook - Using Contacts 1 May 31st 07 10:26 AM
Windows Explorer 7: Lost game files & fighting to open files & bro Totally Frustrated 7 Outlook Express 4 February 2nd 07 03:07 PM
can't open pps. files in outlook davwand Outlook Express 1 January 7th 07 09:59 AM
outlook client cannot open Tif files Bill Outlook - Fax Functions 3 July 17th 06 09:53 PM


All times are GMT +1. The time now is 09:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2017 Outlook Banter.
The comments are property of their posters.