B
bluejackethive72
I am working with a Word Macro. In the macro there are calls to
GetTempPathA API function. A client has XP and Word 2000 and the return
value of this call is 0 with no dll error number. So far this is the only
client that has this problem. Here is the code for the call:
Private Declare Function GetTempDir Lib "kernel32" Alias "GetTempPathA"
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
Const MAX_PATH = 260
Dim lReturnVal As Long
Dim sTempDir As String * MAX_PATH
Dim lLastDllError As Long
Dim errDesc As String
On Error GoTo Handle_Error
lReturnVal = GetTempDir(MAX_PATH, sTempDir)
If lReturnVal = 0 Then 'error
lLastDllError = Err.LastDllError
I work with another program that is written in Visual Basic and makes the
same call to get the temporary directory and writes a file in the directory.
The Word macro now needs to read this file, so I know the API calls are
working for VB but not for VBA.
Does anybody have an idea of what might be the problem?
GetTempPathA API function. A client has XP and Word 2000 and the return
value of this call is 0 with no dll error number. So far this is the only
client that has this problem. Here is the code for the call:
Private Declare Function GetTempDir Lib "kernel32" Alias "GetTempPathA"
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
Const MAX_PATH = 260
Dim lReturnVal As Long
Dim sTempDir As String * MAX_PATH
Dim lLastDllError As Long
Dim errDesc As String
On Error GoTo Handle_Error
lReturnVal = GetTempDir(MAX_PATH, sTempDir)
If lReturnVal = 0 Then 'error
lLastDllError = Err.LastDllError
I work with another program that is written in Visual Basic and makes the
same call to get the temporary directory and writes a file in the directory.
The Word macro now needs to read this file, so I know the API calls are
working for VB but not for VBA.
Does anybody have an idea of what might be the problem?