Initialise (initialize) public folders for access with VBA

Thanks for reading.

Ok, so I have a well established bit of code which sits happily on a machine reading the contents of a public mail folder through Outlook, stripping off attachments and recording the path to which they were saved, taking the HTML from the e-mail and putting it in a rich text field, and identifying key words in the subject line which prompts users to do various things with the content.

My problem is that every so often Exchange needs to restart, and this machine loses contact with the public folders. Apparently when Outlook first opens, public folders are not populated to save on overheads. It takes a user to manually browse them from Outlook to initialise them. Only then can they be accessed through VBA.

This means that someone has to manually log on and poke the public folder, which I'd rather didn't need to happen.

I've tried all I can think of, including using the popular "GetFolder" function, then telling Access to .Display the folder. This simply fails (no error, the window just closes as soon as it opens). GetFolder does seem to be able to retrieve the folder successfully though.

Does anyone know a way to initialise Outlook public folders from VBA in Access?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
As far as I understand you:
You're automating Outlook to do some mail fiddling.
This is a long running process.
Exchange restarts.
You want to reconnect your automation instance?

Imho you should reduce the amount of time needed for your process,
jjnet123Author Commented:
Thanks for the comment, however the process is a short one. It's called every few minutes to look at the mailbox and process anything new in there.

It sits there and runs, 24/7. It works well, apart from this one issue.

An alternative would be to tell Outlook to initialise the folder when it starts I suppose, but I'm not sure where to start with that.
jjnet123Author Commented:
Well, it seems one option would be to Shell the following command to open Outlook and browse to your folder immediately:

Shell (Outlook.exe /select " & chr(34) & "outlook:\\Public Folders -\All Public Folders\MyPublicFolder" & chr(34)

This may require Outlook programmatic access security settings to be modified as well which is relatively straightforward.

Hopefully that might help someone in the future.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jjnet123Author Commented:
Nobody else was able to advise.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.