Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I'm looking for appropriate code in de OKButton of a multi item listbox. This code should trigger different actions depending on which procedure the UserForm was called from. I mean if the UserForm is called by macro A the action should be aaaa and if it is called by macro B the action should be bbbb etc. How can I refer to the calling macro in the OK Button code ? Thanks a lot Herman |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Herman,
There is no built in way to determine what macro called the form. You could add a Public variable to the form, set that variable to the macro name prior to showing the form, then test that variable when OK is clicked. E.g., ' in the form's code module Public CallingMacro As String Public Sub OKButton_Click() If CallingMacro = "A" Then aaaa ElseIf CallingMacro = "B" Then bbb ' and so on End If End Sub Then, in the procedures that call the form, UserForm1.CallingMacro = "A" UserForm1.Show -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Herman" wrote in message m... Hello, I'm looking for appropriate code in de OKButton of a multi item listbox. This code should trigger different actions depending on which procedure the UserForm was called from. I mean if the UserForm is called by macro A the action should be aaaa and if it is called by macro B the action should be bbbb etc. How can I refer to the calling macro in the OK Button code ? Thanks a lot Herman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to Look for Text and then Perform Specified Actions | Excel Discussion (Misc queries) | |||
Modify Macro Code Depending on Excel Version | Excel Discussion (Misc queries) | |||
Repeat Code Repetitive Actions? | Excel Discussion (Misc queries) | |||
Calling an XLA macro from code | Excel Programming |