limpiar textboxes colocados en frames, que a su vez están contenidos en pages, de un multipage..

Samuel Cano

Board Regular
Joined
Jun 24, 2002
Messages
62
Hola, mi caso es que tengo 50 cuadros de texto los cuales estoy limpiando con la siguiente instrucción

If lstListaDeCuentas = 10 Then '(limpia todos los textboxes)
ufBajas.MultiPage1.Page1.Frame1.txt_A1 = ""
'... (...txt_B2, ...txt_C3, etc., hasta 50)
End If

Como mencioné, los textboxes están contenidos en otros controles con la ruta siguiente:

ufBajas (formulario)
MultiPage1 (control contenedor)
Page1 (control contenedor)
Frame1 (control contenedor)
Textbox (control a limpiar)

La instrucción de limpieza deseo dispararla desde otro formulario.


He probado los siguientes códigos sin éxito y ya me siento confundido:


CODIGO_1:

Dim obj1 As Control, obj2 As Control, obj3 As Control

For Each obj1 In ufBajas.Controls ' multipage
If TypeName(obj1) Is "MultiPage" Then

For Each obj2 In ufBajas.obj1.Controls ' page
If TypeOf obj2 Is Page Then

For Each obj3 In ufBajas.obj1.obj2.Controls ' frame
If TypeOf obj3 Is Frame Then

For Each obj4 In ufBajas.obj1.obj2.obj3.Controls '
If TypeOf obj4 Is TextBox Then

obj4.Text = ""

End If
Next

End If
Next

End If
Next

End If
Next


CODIGO_2:

Dim pPage As Page, fFrame As Frame, cCont As Control

For Each pPage In ufBajas.MultiPage1.Pages

For Each fFrame In pPage.Controls

If TypeName(fFrame) = "Frame" Then

For Each cCont In fFrame.Controls

If TypeName(cCont) = "TextBox" Then

cCont.Text = ""

End If
Next cCont
End If
Next fFrame
Next pPage

Cualquier ayuda será muy agradecida, he revisado la ayuda de excel, he buscado en internet y sigo sin saber como hacer un cliclo que limpie los controles sin tener que declarar la ruta, de cada uno.

Gracias anticipadas.

-Samuel Cano.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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
Back
Top