Solved

How to program for Controls on Multipage in Excel VBA

Posted on 2011-02-26
9
564 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 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 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

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!

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

690 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