Jump to content

Recommended Posts

Posted

I need to retrieve the user name of the computer, does somebody help me how to do this in VBA?

Thank you,:D

Posted

Hi Gile,

 

LOGINNAME will help me, but is in LISP and I need to retrieve it in VBA

Do you know how to retrieve it in VBA?

Posted

Thanks Gile!

I look the Variable "LOGINNAME" and now I know how to get the user name...

  
Sub GetUserName() 
Dim UserName As String
   
UserName = ThisDrawing.GetVariable("LOGINNAME")

MsgBox UserName
End Sub

Posted

LOGINNAME isn't a LISP function, it's an AutoCAD system variable.

 

I don't know much about VBA, but I think the equivalent of the (getvar "LOGINNAME") LISP expression should be something like :

 

Application.GetVariable("LOGINNAME")

 

Posted

If you are after the computer name, you can get it by reading it's Windows environment variable as follows.

 

 
Sub GetComputerName()
Dim strComputer As String
strComputer = Environ("COMPUTERNAME")
MsgBox strComputer
End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...