![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: May 2003
Location: Chicago
Posts: 163
|
Hi,
I am creating some dynamic code for a form(say userform_initialize etc.) using codemodule. I would like to know how to call that particular module (userform_initialize) to run dynamically using vba code (from my current module). Thanks in advance, Sudhakar |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Dec 2002
Location: Clear Lake, TX
Posts: 4,202
|
Well, you can access procedures inside a UserForm much like you would access methods of other objects. You need to set the scope of the procedure to Public so that it is visible outside of the object. Here is some sample code....
Place this in the userform... Public Sub FormCode_Test() ****MsgBox "This is how to run code inside a UserForm." End Sub Then place this in a standard module... Sub Test() ****UserForm1.FormCode_Test End Sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|