Active X DLL Testing - Runtime Error 91 or Block Variable Not Set

I created an Active X DLL skeleton with the Instancing property set in MultiUse, and there is only one function that does nothing but a message popup saying that it was called.

Then I created a test program and added a DLL to its links.

I added code to declare a DLL class variable Classmodule, create a new object and call a function.

In all cases, I used Intellisense code completion, so VB6, of course, is about the DLL and its class and method.

However, when I run the tester, it reports the error "error 91 object variable" or "Block block not set" when trying to create a new object.

This is a new territory for me, so I hope this is something obvious.


Update: I added a message box to the fn () DLL to say that it was called, and then went to a real life website that uses Active X to call the DLL and saw a message box - but I still get the error in the VB tester application (!?)

0
source share
2 answers

It would be easier to find the problem if you could publish the calling code and the DLL class.

Here is a hunch. Do you remember the Setline that creates the new object?

Correct code

Set obj = New MyDLL.MyObject

Incorrect code

obj = New MyDLL.MyObject
+1
source

Try changing the function in active x dll to return a message instead. Show your message box in your code, not dll.

Try again at the regsvr32 command line "myDll.dll", and then run your code.

+1

Source: https://habr.com/ru/post/1762866/


All Articles