Question

I have a 64 bit DLL which I want to use in VBA. The example from VB.net won't work in VBA as Int32 is not a known VBA data type. Is it possible to get this working in VBA? If so, do I have to write my own class? I'm including a few lines of the example. Thank you.

Imports System
Imports System.Runtime.InteropServices

Friend Class LinkVCMOWRAP
    Declare Function wcmo_init Lib "vcmowr64.dll" ( _
        <MarshalAs(UnmanagedType.AnsiBStr), [In]()> ByRef WCMOarg_Handle As String, _
        <MarshalAs(UnmanagedType.AnsiBStr), [In]()> ByRef WCMOarg_User As String, _
        <Out()> ByRef IntPtr_DataOut As IntPtr, _
        <Out()> ByRef IntPtr_ErrOut As IntPtr) _
            As Int32 
Était-ce utile?

La solution

Int32 and IntPtr aren't valid VBA data types. You'll need to rewrite the function converting the Int32 type to Long and the IntPtr type to Integer.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top