Solved

How to program for Controls on Multipage in Excel VBA

Posted on 2011-02-26
9
535 Views
Last Modified: 2012-05-11
I had Inserted Multipage control in Excel VBA, i had few controls in each page of Multipgae

How would i program for this controls, say if need to write piece of VB code for CommandButton on Multipage when doubleclicked

If i click on any control its taking me to 'MultiPage1_Change' property
0
Comment
Question by:srikanthv2322
9 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 34989911
You have to double click on the control and directly write the code in it.

Here is an example.

Sid

Code Used

Private Sub CommandButton1_Click()
    TextBox2.Text = "Clicked on Page 2"
End Sub

Private Sub CommandButton2_Click()
    TextBox1.Text = "Clicked on Page 1"
End Sub

Open in new window

Multipage-Example.xls
0
 
LVL 41

Expert Comment

by:dlmille
ID: 34990514
Not for points, but you can go into design mode and double click any control and it should take you to the codepage with an opened event, from there you can see what events you can trap with that control by clicking on the listbox to the right on the debugger - e.g., Activate, Open, Change, etc...

Dave
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34991160
>If I click on any control its taking me to 'MultiPage1_Change' property

You will only get that if you double click on MultiPage1 and not double click on a Control on MultiPage1. So, as already advised, double click on the Control and write the code in the code pan that appears.

Patrick
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 45

Expert Comment

by:patrickab
ID: 34991161
oops...

>If I click on any control its taking me to 'MultiPage1_Change' property

You will only get that if you double click on MultiPage1 and not double click on a Control on MultiPage1. So, as already advised, double click on the Control on MultiPage1 and write the code in the code pane that appears.

Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34991302
srikanthv2322,

The sort of syntax needed will be something like this:

If UserForm1.MultiPage1.Pages(0).OptionButton1 = True Then
        'Your code here
End If

See attached file for an example.

Patrick
Multi-page-on-Userform-01.xls
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35191108
>>>>EXPERTS,
I need your help. Please post your closing recommendations within a few days. If you do not respond, I may need to assume that no correct answer was provided.

Tracy, I have given the solution but am waiting for srikanthv2322 to get back.

Sid
0
 
LVL 24

Expert Comment

by:broomee9
ID: 35356943
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now