To Outlook VBA gurus...

  • Thread starter Thread starter fabien.turcotte
  • Start date Start date
F

fabien.turcotte

Hi all,

I'm using Office 2003.

I'm pretty used to VBA with Excel and Access, but not quite familiar
with the Outlook object model. Now, I'm getting some Outlook stuff
into my Excel program.

In a program, I have the user select a folder using

Set olkApp = CreateObject("Outlook.Application")
Set olkNmsp = olkApp.GetNamespace("MAPI")
Set olkMAPI = olkNmsp.PickFolder


The olkMAPI folder's name value is stored at some place (in an Excel
range) for further use.

What I'm trying to do, is to reconnect to Outlook later on an try to
reopen the same folder that was previously returned.

When I recreate the connection, what do I have to do to reassign
olkMAPI to the value stored in my range?

Set olkApp = CreateObject("Outlook.Application")
Set olkNmsp = olkApp.GetNamespace("MAPI")
Set olkMAPI = ??????

I tried olkNmsp.GetFolderFromID, looked at the Explorer object, tried
to look if I could connect using the FolderPath (outlook:\\Mailbox Name
\Inbox\SubFolder)...

Can you guys tell me how I can do this,

Thanks a million,
 
You're on the right track. Store the folder's entry ID, not its name, and
use it with Namespace.GetFolderFromID.
 
Back
Top