A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Get Windows Username



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 29th 07, 08:03 PM posted to microsoft.public.outlook.program_forms
Boyd
external usenet poster
 
Posts: 21
Default Get Windows Username

I'm using the following code with my custom form:

Sub cmdSubmit_Click()
Dim oWsNetwork
Set oWsNetwork = CreateObject("WScript.Network")
Dim strUsername
Set strUsername = oWsNetwork.UserName
Set oWsNetwork = Nothing
Item.UserProperties("UsernameHold") = strUsername
End Sub

The code is failing with the following message: "Object required:
'[string:"jsmith"]', and breaks on the line "Set strUsername =
oWsNetwork.UserName".

Any idea what the problem is?

Thanks,
Boyd

  #2  
Old March 29th 07, 08:33 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Get Windows Username

Never use a Set keyword when assigning a value to a non-object variable.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Boyd" wrote in message ups.com...
I'm using the following code with my custom form:

Sub cmdSubmit_Click()
Dim oWsNetwork
Set oWsNetwork = CreateObject("WScript.Network")
Dim strUsername
Set strUsername = oWsNetwork.UserName
Set oWsNetwork = Nothing
Item.UserProperties("UsernameHold") = strUsername
End Sub

The code is failing with the following message: "Object required:
'[string:"jsmith"]', and breaks on the line "Set strUsername =
oWsNetwork.UserName".

Any idea what the problem is?

Thanks,
Boyd

  #3  
Old March 29th 07, 09:01 PM posted to microsoft.public.outlook.program_forms
Boyd
external usenet poster
 
Posts: 21
Default Get Windows Username

Perfect!
Thanks Sue.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Outlook username and server Sam Stamp Outlook - Installation 2 December 13th 07 08:02 AM
Domain name before username Micke Outlook - Installation 1 July 4th 06 07:08 AM
Outlook 2003 and %username% TLMPLHou66 Outlook - Installation 0 May 10th 06 11:26 PM
OE won't remember username and password Ron Outlook Express 1 April 29th 06 05:52 AM
Using CMW - %Username% Amin from TO Outlook - Installation 2 January 16th 06 07:31 PM


All times are GMT +1. The time now is 11:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.