R
Roger
I have a program which used the following code to retrieve the user's
id from the system;
Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetUserNameText() As String
Dim strReturn As String
Dim intLength As Long
strReturn = String(1024, 0)
intLength = Len(strReturn)
If GetUserName(strReturn, intLength) <> 0 Then
GetUserNameText = Left(strReturn, intLength - 1)
End If
End Function
I then use this variable (GetUserNameText) in a path to locate files
etc;
"D:\DATA\" & GetUserNameText & "\Cognos\CD TDT Sales....xls
This code works fine in a VB6 application that I have build, but when
transferring this into Excel 97 it does not find the path.
Does anyone know of any reasons why this would happen, are there
reasons which would prevent this from working?
Your help is appreciated.
Roger..
id from the system;
Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetUserNameText() As String
Dim strReturn As String
Dim intLength As Long
strReturn = String(1024, 0)
intLength = Len(strReturn)
If GetUserName(strReturn, intLength) <> 0 Then
GetUserNameText = Left(strReturn, intLength - 1)
End If
End Function
I then use this variable (GetUserNameText) in a path to locate files
etc;
"D:\DATA\" & GetUserNameText & "\Cognos\CD TDT Sales....xls
This code works fine in a VB6 application that I have build, but when
transferring this into Excel 97 it does not find the path.
Does anyone know of any reasons why this would happen, are there
reasons which would prevent this from working?
Your help is appreciated.
Roger..