Solved

How to program for Controls on Multipage in Excel VBA

Posted on 2011-02-26
9
543 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

773 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