Re: Loading/using a type library

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Maury Markowitz <MauryMarkowitz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
References.AddFromFile "c:\apath\blpxxx.dll"

That's not VB. VBA, right? Fundamental difference.

Wait, that won't compile, because of course the library isn't loaded in my
References, so the compiler doesn't know it's going to be there. No problem,
let's just do this...

localBlpHandle = CreateObject("BLP_DATA_CTRLLib.BlpData")

429, ActiveX cannot create object.

Any ideas?

I just do this:

Public Function CheckLibrary(ByVal ProgID As String) As Boolean
Dim obj As Object
' Used to insure we have a DLL.
On Error Resume Next
Set obj = CreateObject(ProgID)
CheckLibrary = Not (obj Is Nothing)
Err.Clear
End Function

Then use late-binding throughout. All you can do, in these cases.

And is there any way to map between the filename, the actual library name,
and the name that appears in the References dialog? They're all different!

With enough registry spelunking, I'm sure it's possible. Not sure I'd ever care
enough to get to that level, though, as it's somewhat-to-pretty useless information
in VB.
--
..NET: It's About Trust!
http://vfred.mvps.org


.



Relevant Pages