Code to prompt for browsing Outlook Folders

  • Thread starter Thread starter Donald Fisher
  • Start date Start date
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.
 
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.
 
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
 
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
 
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
 
Back
Top