Can I use iTextSharp in a VBA application?
Since iTextSharp is a .NET library, I registered iTextSharp.dll with: RegAsm iTextSharp.dll /tlb:iTextSharp.tlb /codebase. The Regasm I used is from .NET Framework 4(4.0.30319.1), and my OS is Win7/64 on AMD. I got approx a dozen warnings for generic types. Then I opened Access 2007 and set the reference to iTextSharp.tlb.
Then just in order to see everything was ok, i tried:
Private Sub PDFButton_Click()
Dim pdfTemplate As String
pdfTemplate = "C:TmpD0001.PDF"
Dim TestClass As pdfReader
Set TestClass = pdfReader(pdfTemplate)
The rest was not developed because the execution always stops at the last row with the error: Function or Sub not defined. I realized, by opening the Object window in VB, that any class included by iTextSharp has no member at all.
Therefore my question is:
- Was I wrong by choosing the initial procedure (to make iTextSharp usable by VBA/Access)?
- If I was not wrong, is it that the assembly registration was essentially not successful? If true, why?
I am wondering if this could be due to the generic types signalled by regasm. In this case the reason would be inside the code, as far as I can see. Is there a way to let iTextSharp correctly expose its classes to COM environment?