is there a way to get the name of the computer in VBA?
+2
A:
You can do like this:
Sub Get_Environmental_Variable()
Dim sHostName As String
Dim sUserName As String
' Get Host Name / Get Computer Name
sHostName = Environ$("computername")
' Get Current User Name
sUserName = Environ$("username")
End Sub
Sarfraz
2010-08-23 19:40:18
Looks like you found the same website that I did :)
Tommy
2010-08-23 19:41:06
+2
A:
Dim sHostName As String
' Get Host Name / Get Computer Name
sHostName = Environ$("computername")
Tommy
2010-08-23 19:40:42
Note that Environ variables must be handled with care because they are a security risk (http://stackoverflow.com/questions/3366192/using-nt-login-as-part-of-sql-query-run-via-vba-in-access-2007)
Remou
2010-08-23 21:19:02