View Single Post
  #5  
Old September 28th 07, 06:29 PM posted to microsoft.public.outlook.program_vba
Mark J. McGinty
external usenet poster
 
Posts: 56
Default How can I pull current user info into a custom outlook form?


"Ken Slovak - [MVP - Outlook]" wrote in message
...
Form code (VBScript) can't use Win32 API functions.


In that case:

Set WshNetwork = CreateObject("Wscript.Network")
UserName = WshNetwork.UserName


-Mark




Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Mark J. McGinty" wrote in message
...

"Jenn" wrote in message
...
I am creating a custom form in Outlook and would like to pull in the
current
Users Manager's name. Any suggestions on where I go to find some code to
accomplish that?



If by that you mean the user that's currently logged in to Windows, this
will do it in VB6:


Private Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA"
(ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long)
As Long

Function GetLoggedInUser() As String

Dim UserName As String, Ln As Long
UserName = String$(1024, 0)
Ln = 1023
WNetGetUser vbNullString, UserName, Ln
GetLoggedInUser = UserName

End Function



-Mark




Ads