Outlook Profile via Access

  • Thread starter Thread starter Bob Bonta
  • Start date Start date
B

Bob Bonta

Anyone out there know how to access the Outlook profile
via access? I'm specfically looking for the email address
of the local user running an Access application.

TIA,

BB
 
Bob

This may help:

Sub GetCurrentUsersEmailAddress()

' Assumes reference to Outlook Object Library.

On Error GoTo HandleErrors

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")

' If using email server, allow user to logon
' (Ignored if already logged on or if not
' using server):
objNS.Logon , , True, False

' Write email address to immediate window:
Debug.Print objNS.CurrentUser.Address

Bye:
Set objNS = Nothing
Set objOL = Nothing
Exit Sub

HandleErrors:
MsgBox Err.Description, vbOKOnly, "Error No: " & CStr(Err.Number)
Resume Bye

End Sub


Here's a lead that may help:
www.slipstick.com
See especially Sue Mosher's book.

Geoff
 
Geoff,

Thanks for the tip. Is there anyway, however, to keep the
confirmation box from popping up notifying the user that
Outlook is being accessed - click Yes/No/Cancel ???

v/r

Bob
 
Bob

I don't know is the straight answer.

This (well-intentioned but somewhat annoying) box
appears because of one of Outlook's security patches
to stop viruses from causing havoc.

It is possible to overcome one of Outlook's security
features (namely to allow the opening of so-called
dangerous attachments) by editing the registry
(see www.slipstick.com for details). Whether, by
extension, it's possible to suppress this confirmation
box, I don't know.

There is a utility that comes on the Office CD that
allows you to self-certify your vba code within
Outlook itself. The intention is to suppress the
Outlook opening dialog to enable/disable macros.
It'd be nice if this utility would also suppress the
confirmation box and would certify any vba
code you write within any Office application.

(Do you think Microsoft are listening? Let's hope!)

Probably best to post this question on a specialised
Outlook newsgroup. If you find out the answer,
please let me know. I'll be watching this thread...

Sorry I don't know
Regards.
Geoff
 
Back
Top