View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Referencing UserForm event in module

You can't put event procedures in a regular code module. Events can be used
only in an object module (the form's code module, a Sheet module, the
ThisWorkbook module, or a class module).

I don't see what advantage using separate class to handle event would bring,
but you can certainly do it with a class.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"avi" wrote in message
ups.com...
Hello,

For the sake of clarity, i want to write event procedures that refer
to some components in a Userform, in a separate regular module. Is it
possible to do so and how should i reference the UserForm in the
regular module?

For example, how should this code look in a regular module, while it
comes from UserForm1?


Sub Label30_Click()
Test_GetAColor
Label30.BackColor = UserColor
End Sub


Many thanks
Avi