apply vbs form to click button

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
New at vbs, can anyone tell me how, after writing a form in visual, to attach it to a click button in excel where it will pull the form up. Thx Dan
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Right click on the name tab of the worksheet that contains the button, choose "View Code". In the VB editor that comes up you will see two drop-down menus, one will say "(General)" and the other will say ")Declarations"). Click on the arrow for the "(General)" box, and you should see the name of your button in that list. Select that button. You will now see some code in the window that says something like:

<pre>
Private Sub CommandButton1_Click()

End Sub</pre>

Put your code to show the userform in here. e.g. if your userform is called "UserForm1" then you put this line of code in to show the userform:

<pre>
UserForm1.Show</pre>

Go back to your work book and hopefully if you click your button the userform will show. If nothing happens that check the toolbar called "Control Toolbox" and make sure that the "Design Mode" button hasn't been pressed.

HTH
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,861
Members
449,052
Latest member
Fuddy_Duddy

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