[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to program for Controls on Multipage in Excel VBA

Posted on 2011-02-26
9
Medium Priority
?
580 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 2000 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 42

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:Tracy
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

656 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