标题: 如何在Access的VBA中用代码查询本地机的名字? [打印本页] 作者: leewm 时间: 2003-6-12 20:13 标题: 如何在Access的VBA中用代码查询本地机的名字? 如题。
请各位高手不吝赐教!!作者: sanjian 时间: 2003-6-13 07:49
api很容易做到作者: 李寻欢 时间: 2003-6-13 08:23
'API声明
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
'获取:
Dim Name As String, Length As Long
Length = 225
Name = String(Length, Chr(0))
GetComputerName Name, Length
Name = Left(Name, Length)
MsgBox "您的计算机名称是:" & Name