我有一个宏,该宏在打开Excel文件时获取用户ID(使用belwo函数)。多年来,我们一直使用相同的代码,没有任何问题。我有一个使用Windows 10(64位),Office 365,Excel 2016(32位)的用户,并且该行(“ ebuff = Space $(MAX_USERNAME)”)抛出错误(找不到项目?)消息。 / p>
MAX_USERNAME常量定义如下。解决此问题的任何建议将不胜感激。感谢您的帮助........
Public Const MAX_USERNAME As Long = 15
Function GetThreadUserName() As String
Dim ebuff As String
Dim enSize As Long
ebuff = Space$(MAX_USERNAME)
enSize = Len(ebuff)
If GetUserName(ebuff, enSize) = 1 Then
eEmpl = UCase(TrimNull(ebuff))
eEmpl1 = Mid(eEmpl, 2, 5)
Get_Group
Exit Function
End If
End Function