Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference to a second mailbox in Outlook??

Status
Not open for further replies.

tekvb1977

Technical User
Nov 16, 2005
46
US
I have the VB code that could reference to my default Inbox folder:

Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim myRecipient

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)

I have another mailbox folder called secondMailBox. How Could I reference to the Inbox folder of my secondMailBox.

Any ideas/thoughts will be highly appreciated? Thanks

J
 
Code:
Dim molApp As Outlook.Application, molNamespace As Outlook.NameSpace, molMAPI As Outlook.MAPIFolder

Set molApp = CreateObject("Outlook.Application")
Set molNamespace = molApp.GetNamespace("MAPI")

[COLOR=green][b]'' This works for any folder under "Personal Folders" as long
'' as folder names are provided:[/b][/color green]
Set molMAPI = molNamespace.Folders("Personal Folders").Folders("Inbox").Folders("SubFolderName")

[COLOR=green][b]'' This works only with OL Default Folders
'' and subfolders:[/b][/color green]
Set molMAPI = molNamespace.GetDefaultFolder(olFolderInbox).Folders("SubfolderName")

TomCologne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top