I currently have a VB 5.0 application that uses Outlook 97 on a PC running Windows XP. I'm trying to pull off the CurrentUser from the Outlook object and display it in a txtbox in my VB application. I was told that MAPI is unavailable with Windows XP and that you have to use CDO. Is this true? If so, how would you get the CurrentUser from Outlook 97? Here is a piece of VB I put together real quick to get the CurrentUser from Outlook:
Public Function OutlookUser() As String
Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim strUser As String
Set objOutlook = CreateObject("Outlook.application"
Set nms = objOutlook.GetNamespace("MAPI"
strUser = nms.CurrentUser
Debug.Print "Outlook User Name: " & strUser
objOutlook.Quit
End Function
Will the above code work with Windows XP or how would you do it with CDO?
Thanks
Public Function OutlookUser() As String
Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim strUser As String
Set objOutlook = CreateObject("Outlook.application"
Set nms = objOutlook.GetNamespace("MAPI"
strUser = nms.CurrentUser
Debug.Print "Outlook User Name: " & strUser
objOutlook.Quit
End Function
Will the above code work with Windows XP or how would you do it with CDO?
Thanks