So I’m moving along quite nicely integrating some code to handle document checkins into the DOCS Open Document Management System via their API, when I hit a nasty little snag.
I try to run the app and get a compile time error at
x$ = string$(78, 10)
Saying that STRING$ is not a valid function.
Huh?!
A little digging and come to find out, the DOCS Open api typelib PCDTYPE.TLB contains a constant definition of STRING. Of course, that is overriding the VBA definition and boom, a problem.
I could go through my app and replace all STRING$ occurrances with VBA.STRING$… I could, but that seems just flat nasty.
Matt Curland’s PowerVB to the rescue again. Load up TLB Editor included with the book, one quick change to rename the bogus constants, and then a good scrubbing of the registry to remove all traces of the old TLB and we’re back in business.
Of course, you wouldn’t want to redistribute the modified TLB file, but, since all the definitions in it are compiled into your VB app, you wouldn’t have to do that anyway.
Technically, you should be able to alter the precedence of references (such that the VBA class definitions would have more weight than the PCDTYPE entries).
Alas, that didn’t seem to work in this case (I’m guessing because the VBA reference is a built in).
Moral: If you’re still messing with VB6 on occasion (I know you’re out there!), Matt’s book is a must have. And you can probably get it cheap on the bargain racks now.