Hi guys,

I'm getting the error "This program has performed illegal operation error" when I access even a simple property of Mapi.session object. My deafault mail client is Outlook.

eg. The following code displays the CurrentUser name but after dispaying it, VB gets closed by saying "This program has performed illegal operation"

Private Sub Command1_Click()
Dim oSession As Mapi.Session
Set oSession = New Mapi.Session
oSession.Logon "", "", False, False
MsgBox oSession.CurrentUser
Set oSession = Nothing
End Sub

Can anyone suggest me what to do ASAP?

Thank you,
Sandeep