-
Paul,
thanx for the quick answer. I changed 'Project Properties' and code to be as you posted but the answer now is: "".
If you could check the code below I would apreciate.
[VBA]
Sub teste()
a = LastUser("\\SERVIDOR\ARQUIVOS\SEQUENCIAS_MAQUINAS\SISTEMAS\CONTROLE_OFS.xls m")
End Sub
Public Function LastUser(strPath As String) As String
Dim strXl As String
Dim strFlag1 As String, strflag2 As String
Dim i As Variant, j As Variant
Dim hdlFile As Long
Dim lNameLen As Byte
strFlag1 = Chr(0) & Chr(0)
strflag2 = Chr(32) & Chr(32)
hdlFile = FreeFile
Open strPath For Binary As #hdlFile
strXl = Space(LOF(hdlFile))
Get 1, , strXl
Close #hdlFile
j = InStr(1, strXl, strflag2)
#If Not vba6 Then
For i = j - 1 To 1 Step -1
If Mid(strXl, i, 1) = Chr(0) Then Exit For
Next
i = i + 1
#Else
i = InStrRev(strXl, strFlag1, j) + Len(strFlag1)
#End If
lNameLen = Asc(Mid(strXl, i - 3, 1))
LastUser = Mid(strXl, i, lNameLen)
End Function
[/VBA]
Thanx in advance.
Elias
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules