ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   user form and frame control (https://www.excelbanter.com/excel-programming/322943-user-form-frame-control.html)

Gixxer_J_97[_2_]

user form and frame control
 
in my user form i have 9 frames walking the user through the appropriate steps.

in the setup of the frames i am using the following code:

<BEGIN VB CODE
counter = 0
For Each o In Me.Controls()
counter = counter + 1
If TypeOf o Is Frame Then
o.Move 0, 0, 306, 294
o.Visible = False
End If
Next
msgbox counter
<END VB CODE

this code loops 79 times!!!

i created this form from scratch and added the frames one by one -
occasionally when dragging the frames around, one frame got put inside
another. i used CTRL+Z to undo the move.

any ideas why this would loop 79 times?

Tom Ogilvy

user form and frame control
 
I assume you don't have 9 empty frames. You are looping once for each
control - so it wouldn't necessarily be surprising that you are looping 79
times.

Try this:

<BEGIN VB CODE
counter = 0
For Each o In Me.Controls()
If TypeOf o Is Frame Then
counter = counter + 1
o.Move 0, 0, 306, 294
o.Visible = False
End If
Next
msgbox counter
<END VB CODE

--
Regards,
Tom Ogilvy


"Gixxer_J_97" wrote in message
...
in my user form i have 9 frames walking the user through the appropriate

steps.

in the setup of the frames i am using the following code:

<BEGIN VB CODE
counter = 0
For Each o In Me.Controls()
counter = counter + 1
If TypeOf o Is Frame Then
o.Move 0, 0, 306, 294
o.Visible = False
End If
Next
msgbox counter
<END VB CODE

this code loops 79 times!!!

i created this form from scratch and added the frames one by one -
occasionally when dragging the frames around, one frame got put inside
another. i used CTRL+Z to undo the move.

any ideas why this would loop 79 times?





All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com