Code to prompt for browsing Outlook Folders

D

Donald Fisher

I want to be able to click a button that will initiate a folder browser
in Outlook and then save the selected folder's EntryID etc. to a
variable. All I think I need is to know how to get the prompt to browse
and I can probably figure out the rest.
 
M

Michael Bednarek

I want to be able to click a button that will initiate a folder browser
in Outlook and then save the selected folder's EntryID etc. to a
variable. All I think I need is to know how to get the prompt to browse
and I can probably figure out the rest.

Maybe the PickFolder method does what you want.
 
D

Donald Fisher

Thanks for the tip. I'm still having a bit of a problem using the
PickFolder method. I'm trying to retrieve folder information and when I
try to save each piece to a variable (i.e. ENTRYID then STOREID then
etc.) I am prompted each time to select a folder. I'd like to be able
to select the folder once and then retrieve any folder properties from
one selection. My knowledge of VB is limited so please bare with me.
Thanks again for the help. My current code is:

----
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim txtENTRYID, txtSTOREID
Set olns = ol.GetNamespace("MAPI")
txtENTRYID = olns.PickFolder.ENTRYID
txtSTOREID = olns.PickFolder.STOREID
MsgBox txtENTRYID
MsgBox txtSTOREID
 
M

Michael Bednarek

Thanks for the tip. I'm still having a bit of a problem using the
PickFolder method. I'm trying to retrieve folder information and when I
try to save each piece to a variable (i.e. ENTRYID then STOREID then
etc.) I am prompted each time to select a folder. I'd like to be able
to select the folder once and then retrieve any folder properties from
one selection. My knowledge of VB is limited so please bare with me.
Thanks again for the help. My current code is:

----
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim txtENTRYID, txtSTOREID
Set olns = ol.GetNamespace("MAPI")
txtENTRYID = olns.PickFolder.ENTRYID
txtSTOREID = olns.PickFolder.STOREID
MsgBox txtENTRYID
MsgBox txtSTOREID
----

I'm sure I'm being prompted two times because of the two variables both
being pointed to the PickFolder method but don't know how to set a
variable to remember which folder was picked?

Try:
Dim fldFolder As MAPIFolder
Dim txtENTRYID, txtSTOREID
Set fldFolder = Application.GetNamespace("MAPI").PickFolder
txtENTRYID = fldFolder.EntryID
txtSTOREID = fldFolder.StoreID
 
D

Donald Fisher

Great! Thanks a ton!

Michael Bednarek wrote:
Michael said:
Try:
Dim fldFolder As MAPIFolder
Dim txtENTRYID, txtSTOREID
Set fldFolder = Application.GetNamespace("MAPI").PickFolder
txtENTRYID = fldFolder.EntryID
txtSTOREID = fldFolder.StoreID



Try:
Dim fldFolder As MAPIFolder
Dim txtENTRYID, txtSTOREID
Set fldFolder = Application.GetNamespace("MAPI").PickFolder
txtENTRYID = fldFolder.EntryID
txtSTOREID = fldFolder.StoreID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top