I suggest you add a sub to your app that takes a Strng argument, and writes it to a file.
Let's say it is Public Sub Say (Text As String).
Then repeatedly in your code add
Code:
Say "Opening Folder"
(or whatever you are about to do in the program flow.) You can concatenate values, what time it is, and so on. This way you can read through that log file, and see what your app was able to accomplish, and where the problem happensâexactly. (One you get to the general area of the error, you can remove the "Say" statements that are nowhere near the pproblem, and add more detail reporting in the vicinity of the problem.)
Once you have found where the problem is, you can try various work-arounds to see if you can find a way to accomplish your task.
Or, if this gives you insight, you can post that insigt here so that maybe a solution can be discovered.
One thing you can report is:
Code:
Private Declare Function GetUserName _
Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long _
) As Long
...
Dim lngCnt As Long
Dim lngRtrn As Long
Dim sUserNm As String * 150
lngRtrn = GetUserName(sUserNm, 149)
lngCnt = InStr(sUserNm, Chr$(0))
If lngCnt < 2 Then
Say "No UserName obtained by GetUserName()."
Else
sUserNm = Left$(sUserNm, lngCnt - 1)
Say "UserName = """ & sUserNm & """"
End If
If you find a distinct difference in the username, perhaps you'll uncover a permission issue. Who knows?