Solved

How to program for Controls on Multipage in Excel VBA

Posted on 2011-02-26
9
557 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
Technology Partners: 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: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

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.

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…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

739 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