ZXing.Net in VBA

May 25, 2013 at 5:08 AM
In another thread, I ask for Working in VB6, know it can work on COM interop.
(I succeed work on VB6 via commandline assembly, thanks for Micjahn's information)
I think VBA also need to be work on COM interop.

I found many document talking about how about COM interop, still don't how make ZXing.Net work on COM interop (Sorry, I'm a newly in programming, only know about VB,net VB6 VBA)

I tried "RegAsm ZXing.dll /tlb /codebase",
and I tried "Set MyVBzxing = CreateObject("ZXing.BarcodeReader"),
not work at both (I used net2.0 assembly)

I don't how to assembly ZXing.Net to COM interop in C# source code.

Any body can help to make a COM interop or ActiveX DLL assembly version for ZXing.Net ?
Coordinator
May 26, 2013 at 7:41 PM
I made a small test with ZXing.Net and VB6. It works:
  1. open a command prompt and execute the following: regasm zxing.dll /codebase /tlb:zxing.tlb
  2. open a VB6 project and go to the "References"
  3. open the zxing.tlb file and add it as a reference (the name is a little bit unconventional: "port of the java based barcode scanning library for .net...")
  4. now create an instance:
    Dim reader As BarcodeReader
    Set reader = new BarcodeReader()
    reader.decode(...)
It should work the same way for VBA, I think.
May 29, 2013 at 4:57 AM
Edited May 29, 2013 at 12:43 PM
I got some error message on Step 1, please, is it normal ?
When I enter the "regasm zxing.dll /codebase /tlb:zxing.tlb" in command prompt"
Type has been successfully registered
Type library export tool in dealing with 'ZXing.IBarcodeReaderGeneric `1, zxing' when the warning. Warning
: Type library exporter encountered a generic type. Generic class can not be exposed to the COM.
Type library export tool in dealing with 'ZXing.IMultipleBarcodeReaderGeneric `1, zxing' when police
Reports. Warning: The type library exporter encountered a generic type. Generic class can not be exposed to the COM.
Type library export tool in dealing with 'ZXing.BarcodeReaderGeneric `1, zxing' when the warning. Warning:
 Type library exporter encountered a generic type. Generic class can not be exposed to the COM.
.
.
.
Type library export tool in dealing with 'ZXing.IMultipleBarcodeReader.get_PossibleFormats (# 0),
zxing 'with warnings. Warning: The type library exporter encountered in the signature generic type instance. Generic Process Sigma can not be exported to COM.
Type library export tool in dealing with 'ZXing.IMultipleBarcodeReader.set_PossibleFormats (value
), Zxing 'when the warning. Warning: The type library exporter encountered in the signature generic type instance. Generics The code can not be exported to COM.
Components have been exported to 'zxing.tlb', and type libraries have successfully logged
Coordinator
May 29, 2013 at 12:14 PM
That are only warnings because generic types can't be exported.

You can ignore them.
May 29, 2013 at 12:45 PM
Thank you ! ....... I going to try it !
Aug 10, 2015 at 2:29 PM
micjahn wrote:
I made a small test with ZXing.Net and VB6. It works:
  1. open a command prompt and execute the following: regasm zxing.dll /codebase /tlb:zxing.tlb
  2. open a VB6 project and go to the "References"
  3. open the zxing.tlb file and add it as a reference (the name is a little bit unconventional: "port of the java based barcode scanning library for .net...")
  4. now create an instance:
    Dim reader As BarcodeReader
    Set reader = new BarcodeReader()
    reader.decode(...)
It should work the same way for VBA, I think.
Hi,
Please post a sample with VB6.
Thank you very much.