Users mail adress(es)

D

Doug Robbins - Word MVP

The following will return the email address for the default mail account:

Dim olook As Outlook.Application
Dim bStarted As Boolean
On Error Resume Next

Set olook = GetObject(, "Outlook.Application")

If Err <> 0 Then
Set olook = CreateObject("Outlook.Application")
bStarted = True
End If

MsgBox olook.Session.CurrentUser.Address

' Close Outlook if it was started by this macro.

If bStarted Then

oOutlookApp.Quit

End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

Bo Hansson

Many thanks!

/BosseH

Doug Robbins - Word MVP said:
The following will return the email address for the default mail account:

Dim olook As Outlook.Application
Dim bStarted As Boolean
On Error Resume Next

Set olook = GetObject(, "Outlook.Application")

If Err <> 0 Then
Set olook = CreateObject("Outlook.Application")
bStarted = True
End If

MsgBox olook.Session.CurrentUser.Address

' Close Outlook if it was started by this macro.

If bStarted Then

oOutlookApp.Quit

End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Top