H
H. Martins
Hi,
I've got the following code in one form's VBA:
Option Compare Database
Option Explicit
Public fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Calling it works fine, but as I will call it from other forms I
decided to transfer it to a module - not really sure what I was doing.
Basically I wanted sort of #include a file in the form's VBAs.
I transferred the function do a new Module. Looked like I just had to
define it as Public:
Public fOSUserName() As String
But then I have error message "Invalid Outside Procedure" in:
strUserName = String$(254, 0) ' << in the "254"
I struggled with the helps ans this newsgroup but I didn't find (or
realize I was finding) a way out.
Could I have some help, please?
Thanks,
Henry
I've got the following code in one form's VBA:
Option Compare Database
Option Explicit
Public fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Calling it works fine, but as I will call it from other forms I
decided to transfer it to a module - not really sure what I was doing.
Basically I wanted sort of #include a file in the form's VBAs.
I transferred the function do a new Module. Looked like I just had to
define it as Public:
Public fOSUserName() As String
But then I have error message "Invalid Outside Procedure" in:
strUserName = String$(254, 0) ' << in the "254"
I struggled with the helps ans this newsgroup but I didn't find (or
realize I was finding) a way out.
Could I have some help, please?
Thanks,
Henry