Outlook email addresses

aziz rasul

Active member
Local time
Today, 16:50
Joined
Jun 26, 2000
Messages
1,935
I have two email addresses in Outlook and I am trying to write code that will tell what these two email addresses are. However when I use the following code it only recognizes one email address.

Code:
Public Function OutlookAccounts() As Integer
    
    Dim OutApp As Outlook.Application
    Dim i As Long

    Set OutApp = CreateObject("Outlook.Application")

    For i = 1 To OutApp.Session.Accounts.Count
        MsgBox OutApp.Session.Accounts.Item(i)
    Next i
    
    OutlookAccounts = i - 1
    
End Function
 
In vb, lists start at zero.
So it's prob.
For I= 0 to obj.count -1
 
OutlookApp.Session.Accounts.Count gives a value of 1. When I made i begin from 0, OutApp.Session.Accounts.Item(0) does not return anything.
 

Users who are viewing this thread

Back
Top Bottom