Name of controls in multipage and how to adress controll

haseft

Active Member
Joined
Jun 10, 2014
Messages
280
hi,
I have one multipage with 3 tab/page.
each page have some controlls, textbox, listbox, combobox

have 2 questios.:
1)
in page1 i have a textbox with name "Textbox1".
in page2 i want a textbox with same name "Textbox1".
this is not working. i get error "name exist".

2)
how do I adress a specifc controll for ex. page2?
Code:
dim mytext as String
mytext = MultiPage1.Page2.TextBox1.Value
not working
help with this please.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,303
Office Version
  1. 365
Platform
  1. Windows
You can't have controls with the same name on a form even if they are on separate pages.

Why not include the page the controls in some format when naming the controls?

If you want to refer to control on a multipage page via it's parent you can use this.
Code:
Dim myText As String

    Me.MultiPage1.Pages(0).Controls("TextBox1").Value
 
Solution

haseft

Active Member
Joined
Jun 10, 2014
Messages
280
You can't have controls with the same name on a form even if they are on separate pages.

Why not include the page the controls in some format when naming the controls?

If you want to refer to control on a multipage page via it's parent you can use this.
Code:
Dim myText As String

    Me.MultiPage1.Pages(0).Controls("TextBox1").Value
thanks Norie, it works (y) 🙂
 

Forum statistics

Threads
1,141,415
Messages
5,706,306
Members
421,441
Latest member
VapesRub

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top