Thanks
One easy way is to use enviroment settings. For a complete list try this:
For i = 1 To 50
Debug.Print i, Environ(i)
Next
Specifically, for the computer name, try this:
MsgBox Environ("COMPUTERNAME")
Just be aware that these settings can be changed by the user, but for the most
part, are usually accurate....
HTH
LFS
Here's another way that no user can muck up...
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Private Function CurrentMachineName() As String
Dim Buffer As String
Dim nLen As Long
Const CNLEN As Long = 15 ' Maximum computer name length
Buffer = Space$(CNLEN + 1)
nLen = Len(Buffer)
If GetComputerName(Buffer, nLen) Then
CurrentMachineName = Left$(Buffer, nLen)
End If
End Function
--
.NET: It's About Trust!
http://vfred.mvps.org