none
Can vba process a byte() argument from a vb .net dll function? RRS feed

  • Question

  • I am working with Visual Studio 2010, VB .NET in a Windows 7, 64-bit environment. I created a com object in vb .net4. I can reference this dll from Access 2010 using vba. The dll is checked in Tools, Reference. I can see the functions when I use the following code.

    Dim c as C4.Class1

    Set c = New C4.Class1

    Dim strData as string

    strData = c.MainDecCntName(.....

    However, for some functions the intellisense will display the functions arguments. The functions that have a byte() argument do not display.

    For example this function MainDecCntName(ByVal encryptedData As Byte(), ByVal ContainerName As String, ByVal sPathFileName As String) As String displays the following err.

    Compile error: Function or interface marked as restriced, or the function uses an Automation type not supported in Visual Basic.

    Can vba handle a byte() agrument from a dll function?

    Do I need to declare this dll function?

    I created an array of byte datatype in vba and try to pass it to the MainDecCntName’s ByVal encryptedData as Byte() argument and the err referenced above is displayed.

    Can vba pass an byte array that will be accepted as a byte() in this dll function?


    Kim Khan

    Tuesday, May 8, 2012 9:39 PM

Answers

  • It looks like the solution was to change

    ByVal encryptedData as Byte() argument
    to
    ByRef  encryptedData as Byte() argument

    in the Public Function MainDecCntName(ByVal encryptedData As Byte(), ByVal ContainerName As String, ByVal sPathFileName As String) As String   function in vb .NET 4.

    Passing the Byte() using ByRef didn't produce the err.

    However, I need to do more robust testing to really confirm that this works. 


    Kim Khan

    • Marked as answer by kkhan7 Tuesday, May 15, 2012 1:58 PM
    Thursday, May 10, 2012 7:02 AM