K
Karen
Dear All,
I got 2 error messages when a custom outlook form is run. I want to get the
loginID of the user and the name of his manager.
I believe that the errors are in the following code.
The error messages are "Error in logon: 424 object required" and "Error
getting AddressEntry: 424 Object required"
How to solve this problem? Thanks!
Set objNameSpace = Application.GetNameSpace("MAPI")
Set objCurrentUser = objNameSpace.CurrentUser
Set objAddressEntry = objCurrentUser.AddressEntry
Set strManager = objAddressEntry.Manager
'Assign alias
'Start the CDO code to find a match.
Set cdoSession = CreateObject("Mapi.session")
cdoSession.Logon ,,false,false,0 'Use the existing Outlook session.
If err.number <> 0 Then
MsgBox "ERROR in logon: " & err.number & vbCRLF & err.description
End If
'Get the AddressEntry of the recipient/current user.
Set cdoAddrEntry = cdoSession.CurrentUser
If err.number <> 0 Then
MsgBox "ERROR getting AddressEntry: " & err.number & vbCRLF &
err.description
End If
'Get properties.
strAlias = cdoAddrEntry.fields(cdoPR_Account)
cdoSession.logoff
Set cdoAddrEntry = Nothing
Set cdoSession = Nothing
I got 2 error messages when a custom outlook form is run. I want to get the
loginID of the user and the name of his manager.
I believe that the errors are in the following code.
The error messages are "Error in logon: 424 object required" and "Error
getting AddressEntry: 424 Object required"
How to solve this problem? Thanks!
Set objNameSpace = Application.GetNameSpace("MAPI")
Set objCurrentUser = objNameSpace.CurrentUser
Set objAddressEntry = objCurrentUser.AddressEntry
Set strManager = objAddressEntry.Manager
'Assign alias
'Start the CDO code to find a match.
Set cdoSession = CreateObject("Mapi.session")
cdoSession.Logon ,,false,false,0 'Use the existing Outlook session.
If err.number <> 0 Then
MsgBox "ERROR in logon: " & err.number & vbCRLF & err.description
End If
'Get the AddressEntry of the recipient/current user.
Set cdoAddrEntry = cdoSession.CurrentUser
If err.number <> 0 Then
MsgBox "ERROR getting AddressEntry: " & err.number & vbCRLF &
err.description
End If
'Get properties.
strAlias = cdoAddrEntry.fields(cdoPR_Account)
cdoSession.logoff
Set cdoAddrEntry = Nothing
Set cdoSession = Nothing