开发者

Testing Active X DLL - runtime error 91 object variable or With block variable not set

I created a skeleton Active X DLL with its Instancing property set to MultiUse and only one function which does nothing but pop up a message box saying that it has been called.

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

I added code to declare a variable of the DLL's Classmodule, to create a new object and to call the function.

In all cases I used Intellisense code completion, so VB6 certainly about the DLL and it's class & method.

However, when I run the tester it reports runtime "error 91 object variable or With block variable not set" when trying to create the New object.

This is new territory for me, so hopefully it is something obvious.


Update: I added a message box开发者_运维技巧 in a DLL fn() to say that it had been called, then went to a real life web site that uses Active X to call into the DLL and saw the message box - but I still get the error in a VB tester application(!?)


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

Here's a guess. Have you remembered the Set on the line that creates the new object?

Correct code

Set obj = New MyDLL.MyObject

Incorrect code

obj = New MyDLL.MyObject


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

Else, try in command prompt, regsvr32 "myDll.dll", and then run your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜