|
The Reason Why My VB Program Fails On Notes 6 I've been bitten by this twice in the past few months. Fortunately, it only took me a few minutes the second time around to remember that it was indeed something I had seen before, but it's pretty annoying It's also annoying that it has to do with COM access, and Google automatically filters out the word "COM" from queries, so it's tough to formulate a query that will bring you any useful information from the blogosphere and various Notes-related forums. I'm hoping that this post in my blog will include enough of the appropriate search terms that it will manage to get near the top of the search results for many reasonable queries.. Here's the problem. You're running on a system with Notes 6 or Notes 6.5 installed. You're developing a Visual Basic program to access Notes and Domino. It doesn't actually have to be VB, of course, but that's the language most commonly used for COM programs. Or maybe you're simply using a program that you or somebody else wrote months ago using the Domino Objects (which are the ActiveX -- a.k.a. COM -- components that Lotus supports for external programs in VB and other languages). If you're developing, it just doesn't work even though you've done everything right. If it's an existing program, perhaps it even worked on Notes 5, but now that you've upgraded to ND6 it suddenly doesn't work any more. You're getting an error message: "Run-time Error: ActiveX Component Can't Create Object". Or perhaps you're getting "Automation Error: The specified object could not be found". Another thing you might have noticed in the VB IDE is that the Lotus Domino Objects selection in the References dialog for your project does not seem to be sticking after you've selected it, saved your project, and re-opened it later, causing you to get compile errors for references to NotesSession and the various other Notes classes. All of this is happening even though you've done everything right. The code is correct. You have a 'dim s as NotesSession' and 'call s.Initialize()', but if and if you single-step in the debugger these will appear to execute, but if you look closely at the value of the NotesSession variable in the debugger, you'll find that although it isn't 'Nothing', it isn't really initialized either. Then you step through the code to something like 'set db = s.GetDatabase("","names.nsf") and you get the error. Very weird. What's going on?
The answer is the Notes 6 installation botched the registration of the nlsxbe.dll file that contains the ActiveX code for the Domino Object classes. Here is the Lotus Technote that explains the problem in the Domino 6 install. It gives two solutions: either manually editing the appropriate registry entry, or opening a DOC box, switching to the Notes program directory, and running 'regsvr32 nlsxbe.dll'. Problem fixed, right? Well, not quite. I did this when I first encountered the problem after installing Notes 6. Many months went by, and I upgraded to Notes 6.5... and not Notes 6.5.1. More months went by, and I had another occasion to write a Visual Basic program, and the problem recurred. Apparently the 6.5 install -- which was to the same program directory that I had used for Notes 6 -- didn't just fail to register the DLL. It blew away the previous registration.
|