In Word 2002, I am trying to use scripting to get the user's login name (not
the username in Options). Without dimming wscript, I get an error "variable
not defined" (on the wscript object); if I dim wscript, I get another error
"error 424 - object required" when I set wshNetwork. I have the reference
to the Windows Script Host Object Model set.
Private Sub getUName()
Dim WshNetwork, UName As String, wscript
Set WshNetwork = wscript.CreateObject("WScript.Network")
UName = WshNetwork.UserName
What am I missing?
TIA
Shauna Kelly - 16 Oct 2006 21:27 GMT
Hi zSplash
Have you tried this one:
How to get the username of the current user
http://www.word.mvps.org/FAQs/MacrosVBA/GetCurUserName.htm
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> In Word 2002, I am trying to use scripting to get the user's login name
> (not the username in Options). Without dimming wscript, I get an error
[quoted text clipped - 10 lines]
>
> TIA
Jay Freedman - 17 Oct 2006 02:27 GMT
If you still want to use scripting, just omit the "wscript." before
CreateObject:
Dim WshNetwork, UName As String
Set WshNetwork = CreateObject("WScript.Network")
UName = WshNetwork.UserName
works for me.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>Hi zSplash
>
[quoted text clipped - 21 lines]
>>
>> TIA
zSplash - 17 Oct 2006 17:26 GMT
Thanks Jay!
st.
> If you still want to use scripting, just omit the "wscript." before
> CreateObject:
[quoted text clipped - 38 lines]
>>>
>>> TIA