VB6 - Read Current Outlook Profile Name
Outlook profile info is not accessable using the Outlook Object
Model, but using CDO it is possible (without incurring any security popups!).
VB Code:
Option Explicit
'Add a reference to Microsoft CDO 1.21 Type Library
'If you do not have it installed on your system you can install it
'from your Office CD.
'Also, Outlook needs to be running first!!!
Private Function GetCurrentProfileName() As String
Dim oSession As MAPI.Session
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False
GetCurrentProfileName = oSession.Name
oSession.Logoff
Set oSession = Nothing
End Function
Private Sub Form_Load()
MsgBox "Current Outlook Profile = " & GetCurrentProfileName, vbOkOnly + vbInformation
End Sub
1 Attachment(s)
Re: VB6 - Read Current Outlook Profile Name
Dear Robert,
I am getting the warning Mesage.What could be the problem,
I am using Outlook 2003 version
Dana
Re: VB6 - Read Current Outlook Profile Name
See my FAQ item on the dreaded Outlook Security Prompt. :)
http://vbforums.com/showthread.php?t=402086