T
ted medin
How do i find out the name of the pc from within a vba pgm? TIA
ted medin said:How do i find out the name of the pc from within a vba pgm? TIA
Jay Freedman said:Try this statement:
Environ("ComputerName")
Erm... of course, that isn't a statement, it's an expression that
returns a string. You can assign it to a string variable
Dim MyComputer As String
MyComputer = Environ("ComputerName")
or you can display it
MsgBox Environ("ComputerName")
The obvious but unhelpful answer is "ME isn't an OS, it's a P.O.S."ted medin said:One further problem: xp os gave me the correct name BUT me os gave me ""
Anyone got any ideas? TIA
Erm... of course, that isn't a statement, it's an expression that
returns a string. You can assign it to a string variable
Dim MyComputer As String
MyComputer = Environ("ComputerName")
or you can display it
MsgBox Environ("ComputerName")
This approach, using the Win32 API function GetComputerName, should
work everywhere: http://www.mvps.org/access/api/api0009.htm