Excel VBA to get Outlook email attachment from alternative pst file

jonwas

New Member
Joined
Aug 5, 2019
Messages
5
I have been struggling to find code that will operate from within Excel VBA to;

1) Initiate Outlook (found)
2) Look at the inbox not of the default inbox but of a secondary one from another pst
3) Save all attachments from that inbox into a desktop folder c:/USERS/Wassej03/Documents/IOVFs_Master
4) Save all attachments from a subfolder off the default pst inbox to another desktop folder c:/USERS/Wassej03/Documens/DAS_Assignments

It seem all post I have found that are functional involve the main inbox, and attempts to draw from other pst inboxes or subfolder from the main inbox are either broken code or unavailable.

Note- I abandoned doing this in oulook VBA due to challenges with users version and script rule executions.

All help greatly appreciated.

Jonathan
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Thanks Dante for your answer and links.

The trouble is rooted in my question about how to direct excel to a inbox that isn't the default inbox but one that is in another pst in my email tree. Do you know what code is available to do that. None of the links you provided address that main issue- you do show code to pull from folders and subfolders in a loop (but I am literally trying to point to three distinct folders) - 1)a subfolder from the main email 2) the inbox of an alternative to the default inbox 3) a subfolder of that alternative to the default inbox.

Thanks again - if you can speak to specific code that would address that. in my case the pst is named Diagnostic Orders and has a distinct email address different from the main email address.
 
Upvote 0
So just to clariy further. With the third link you provided I was able to get the subfolder from my main email to operate correctly. I am just not clear on how to define an alternative email address/pst file as the starting point instead of Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Any ideas?
 
Upvote 0
So just to clariy further. With the third link you provided I was able to get the subfolder from my main email to operate correctly. I am just not clear on how to define an alternative email address/pst file as the starting point instead of Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Any ideas?

I have not seen any code that reads directly from the .pst file, you should load your file in outlook and thus be able to read the mail from the folder but in outlook.
 
Upvote 0
Thanks for your attempt. Anyone have code that will allow you to designate an alternative pst inbox to the default so that attachment stripping can work in that inbox tree?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top