Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WithEvents in Module 1

Status
Not open for further replies.

sannas

Programmer
Apr 23, 2004
11
IE
I'm using VBSendMail.dll to send mails but i wanna code a function under my modules to send emails. However when i try to declare

Private WithEvents poSendMail As vbSendMail.clsSendMail


I get a "only valid in Object module Error" compile error.
The dll uses withevents which catches any errors, so i need it for checking errors.

Any ideas on what i can do?
Thanks
 
Have you tried switching it to a form module? Just a guess, since the error says "only valid in Object module Error."

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
i have already did that it works in a form but as we use emails all over the program it would be easier to maintain if we had it in a module.
Thanks

 
The problem is that you need to have an event handler. Objects have event handler, standard code modules do not because they are not objects.

You might creating your own custom class and use that class instead of the standard code module.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top