Error 32 bit Function in 64 bit environment

We use the J Street Access relinker which I noticed it uses the GetOpenFileName dialog. The version we have supports 64 bit office. I tested it on a 64 bit version I used to have and I know it works. Maybe this could help you with yours. I cut out the declaration of the GetOpenFileName and have included in below.

Code:
#If VBA7 Then
    Type tagOPENFILENAME
        lStructSize         As Long
        hwndOwner           As LongPtr
        hInstance           As LongPtr
        lpstrFilter         As String
        lpstrCustomFilter   As Long
        nMaxCustFilter      As Long
        nFilterIndex        As Long
        lpstrFile           As String
        nMaxFile            As Long
        lpstrFileTitle      As String
        nMaxFileTitle       As Long
        lpstrInitialDir     As String
        lpstrTitle          As String
        Flags               As Long
        nFileOffset         As Integer
        nFileExtension      As Integer
        lpstrDefExt         As String
        lCustData           As LongPtr
        lpfnHook            As LongPtr
        lpTemplateName      As Long
    End Type
    
    
    Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" _
        Alias "GetOpenFileNameA" (OPENFILENAME As tagOPENFILENAME) As Boolean

#Else
    Type tagOPENFILENAME
        lStructSize         As Long
        hwndOwner           As Long
        hInstance           As Long
        lpstrFilter         As String
        lpstrCustomFilter   As Long
        nMaxCustFilter      As Long
        nFilterIndex        As Long
        lpstrFile           As String
        nMaxFile            As Long
        lpstrFileTitle      As String
        nMaxFileTitle       As Long
        lpstrInitialDir     As String
        lpstrTitle          As String
        Flags               As Long
        nFileOffset         As Integer
        nFileExtension      As Integer
        lpstrDefExt         As String
        lCustData           As Long
        lpfnHook            As Long
        lpTemplateName      As Long
    End Type
    
    Private Declare Function GetOpenFileName Lib "comdlg32.dll" _
        Alias "GetOpenFileNameA" (OPENFILENAME As tagOPENFILENAME) As Long

#End If

Another thing you could try is to modify your code to use the Access Filedialog and get rid of these declaration all together.
 

Users who are viewing this thread

Back
Top Bottom