How to open UserForm code by VBA?

Sbirro Cornuto

Board Regular
Joined
Mar 18, 2002
Messages
93
'Sup?
How can I open the UserForm code module by macro. Like when I use VBA to open some regular macro, you know with 'Application.Goto Reference:="the name of the Sub"'. This doesn't work if the Sub is in the UserForm. How should I name the Reference? Any ideas?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Just use UserForm1.Show. You can refer to the controls on the userform, from outside it's module, by prefacing the control name with the userform name eg: -

UserForm1.TextBox1.Text = ""
 
Upvote 0
On 2002-03-19 12:18, Mudface wrote:
Just use UserForm1.Show. You can refer to the controls on the userform, from outside it's module, by prefacing the control name with the userform name eg: -

UserForm1.TextBox1.Text = ""

How would I exactly use UserForm.Show? I don't want to show the UserForm, I want to open the UserForm code window in VBE by VBA. Understand? To open the Sub something() in the editor by macro and the Sub something is on the UserForm.
 
Upvote 0
A form is a class module...

The answer given seems to be right

Use this syntax

frmYourForm.Sub_Name

This will load the form into memory but will
not show it
 
Upvote 0
Just to clarify dude.
You have a form called frmDude
Contained within the forms code you have a sub called...
Sub RunThisSub
'code
End Sub

To access this sub outside of the actual running form use this syntax

frmDude.RunThisSub

As I said before, this will load the form into memory but will not show it.
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,710
Members
448,293
Latest member
jin kazuya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top