Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default Referencing UserForm event in module

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default Referencing UserForm event in module

Thanks for your clarification.

My need comes from the fact that the Userform code becomes very long
and difficult to manage, but it is not a critical issue

Avi

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm initialize event run when UserForm is shown [email protected] Excel Programming 2 June 13th 07 02:49 AM
Help.. Add an event to a sheet module Ray Mills Excel Programming 0 February 4th 06 02:17 PM
Option Private Module not preventing cross project referencing seisman Excel Programming 2 July 29th 05 03:24 PM
referencing at module level Mark[_36_] Excel Programming 1 March 1st 04 01:24 PM
Run module ON OPEN event?? MG Excel Programming 1 January 9th 04 12:31 AM


All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"