Error Handling

B

beginer

Hi all,

In order to reduce the size of the DOC, I compile all macro functions in
DLL. But not all users installed that DLL. So error maybe come out from "
Set obj = New myProject1.class1" while users try to run the macro.


"On error goto FineError" statment seems cannot handle the error from that
statment. So what can i do?

Or how can I check the exist of my class "myProject1.class1" in Word?


Thanks for advice.


Here is my code example:

Sub mytest()
On Error GoTo FindError
Set obj = New myProject1.class1
obj.myFunc
obj.mySub

FindError:
If Err <> 0 Then
MsgBox "Error Detect"
End
End If

End Sub


Thanks for advice

Regards
 
J

Jezebel

In place of

Set obj = New myProject1.class1

use

Set obj = CreateObject("myProject1.class1")

that fires a trappable error if the library is not installed.
 
B

beginer

Oh.. Thanks ~


Jezebel said:
In place of

Set obj = New myProject1.class1

use

Set obj = CreateObject("myProject1.class1")

that fires a trappable error if the library is not installed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top