Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2003 - Macro to Open Outlook Data file

Status
Not open for further replies.

rj51cxa

Technical User
Mar 16, 2006
216
GB
My main Outlook.pst file is on my desktop and I have a wireless network to my laptop. If I am away from home, I download my messages into Outlook on my laptop and then, when the network is re-established, open the Outlook.pst file on my desktop in Outlook on my laptop and transfer the messages across.

Going through the actions of "file, open, outlook data file etc." is tedious and time wasting and I would like to create a macro to do this.

I've tried to find a VB code for "file open" but have been unsuccessful. I think the coding must be more complex and would appreciate some advice.

I hope I have selected the correct forum. If not, could someone please advise which forum I should use.

Best Regards
John
 
Hi rj,

Have you looked at the SHELL command?


Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Hi Darrylle,

Sorry to be so long in replying, I've been away from my desk for a few days.

I tried the Shell command but the code I am creating keeps appearing in yellow.

Code:
Sub Open_Archive()
Dim Archive
Archive = Shell("n:\Outlook Personal Folders\John\Archive.pst", 1)
End Sub

I'm not sure what I am doing wrong and would appreciate your advice.
Best Regards
John
 
What about this ?
CreateObject("WScript.Shell").Run """N:\Outlook Personal Folders\John\Archive.pst"""

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV, I'm afraid that didn't work. The code appeared to run but the folder did not open in my mail folders list.

Best Regards
John
 
What happens if you double-click the .pst file from within an explorer window and having outlook already open ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,

It doesn't work I'm afraid. I get a warning message saying that "You are attempting to open a file of type "Office Data File" (.pst)". It offers me an "Open with" option but that is not what I need to do.

To open the file manually from within Outlook, I have to make the following steps:

File - Open - Outlook Data file - then browse to the file to be opened. This is the action that I am trying to automate.

Best Regards
John
 
PHV and Darrylle,

Another very helpful source gave me the lead that has solved it. They suggested that I use the Namespace AddStore Method. This worked and I can now set up a macro button on Outlook to run this code.

Thanks to both of you for your help.
Best Regards
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top