troubleshooting Question

From msAccess find correct email account in outlook

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
OutlookVBAMicrosoft Access
6 Comments1 Solution202 ViewsLast Modified:
Access 2010 vba
outlook

What Am I trying to do:
Trying to perform a search in the correct    "Inbox"

First. : When i open my outlook  I have several Profiles under my Primary profile

>fordraiders@zzzz.com
  Inbox

>bluebook
  Inbox
>redbook
  Inbox


I tried to access the profile directly but it still only searches in the main "InbOx"    (fordraiders@zzzz.com)



Before I perform a search I need to make sure I'm looking in the correct profile ?
before i execute any code..

I'm trying to loop through each profile but this is not working ?

' LOOK FOR OUTLOOK OPEN
Dim objOL As Outlook.Application
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myInbox As Outlook.MAPIFolder
Dim myitems As Outlook.Items
Dim myitem As Object
Dim objInsp As Outlook.Inspector
Dim oAccount As Outlook.Account

For Each oAccount In myOlApp.Session.Accounts
  If oAccount = "redbook" Then
      ' code here
  end if
next
 


Thanks
fordraiders
ASKER CERTIFIED SOLUTION
John Tsioumpris
IT Supervisor
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros