Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 55
Default Multipage userform

I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same stuff, in
about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Multipage userform

A listbox is a listbox, a control is a more generic term for the controls on
a form. So a listbox is a listbox, a textbox is a textbox, but both are also
controls.

You can test the controls collection for the control type


For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "CommandButton": MsgBox ctl.Caption
Select Case TypeName(ctl)
Case "TextBox": MsgBox ctl.Value
Select Case TypeName(ctl)
Case "Label": MsgBox ctl.Caption
'etc.
Next


--

HTH

Bob

"KC" wrote in message
...
I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same stuff, in
about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing



  #3   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 55
Default Multipage userform

I agree.
I have read similar examples many times in the past.
They all led me elsewhere.
Today when I read this again, I know where I have misunderstood it.

"Bob Phillips" wrote in message
...
A listbox is a listbox, a control is a more generic term for the controls
on a form. So a listbox is a listbox, a textbox is a textbox, but both are
also controls.

You can test the controls collection for the control type


For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "CommandButton": MsgBox ctl.Caption
Select Case TypeName(ctl)
Case "TextBox": MsgBox ctl.Value
Select Case TypeName(ctl)
Case "Label": MsgBox ctl.Caption
'etc.
Next


--

HTH

Bob

"KC" wrote in message
...
I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same stuff,
in about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Multipage userform

That's because I explain it so well <BG

--

HTH

Bob

"KC" wrote in message
...
I agree.
I have read similar examples many times in the past.
They all led me elsewhere.
Today when I read this again, I know where I have misunderstood it.

"Bob Phillips" wrote in message
...
A listbox is a listbox, a control is a more generic term for the controls
on a form. So a listbox is a listbox, a textbox is a textbox, but both are
also controls.

You can test the controls collection for the control type


For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "CommandButton": MsgBox ctl.Caption
Select Case TypeName(ctl)
Case "TextBox": MsgBox ctl.Value
Select Case TypeName(ctl)
Case "Label": MsgBox ctl.Caption
'etc.
Next


--

HTH

Bob

"KC" wrote in message
...
I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same stuff,
in about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default Multipage userform

All Dalmations are dogs, but not all dogs are Dalmations.

"Bob Phillips" wrote:

That's because I explain it so well <BG

--

HTH

Bob

"KC" wrote in message
...
I agree.
I have read similar examples many times in the past.
They all led me elsewhere.
Today when I read this again, I know where I have misunderstood it.

"Bob Phillips" wrote in message
...
A listbox is a listbox, a control is a more generic term for the controls
on a form. So a listbox is a listbox, a textbox is a textbox, but both are
also controls.

You can test the controls collection for the control type


For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "CommandButton": MsgBox ctl.Caption
Select Case TypeName(ctl)
Case "TextBox": MsgBox ctl.Value
Select Case TypeName(ctl)
Case "Label": MsgBox ctl.Caption
'etc.
Next


--

HTH

Bob

"KC" wrote in message
...
I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same stuff,
in about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing






.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Multipage userform

Whilst I have no idea what you are on about, surely all dalmations are
dalmatians!

And, not all dalmatians are dogs, some Dalmatians are inhabitants of a
southern coastal region of Croatia.

Bob

"JLatham" wrote in message
...
All Dalmations are dogs, but not all dogs are Dalmations.

"Bob Phillips" wrote:

That's because I explain it so well <BG

--

HTH

Bob

"KC" wrote in message
...
I agree.
I have read similar examples many times in the past.
They all led me elsewhere.
Today when I read this again, I know where I have misunderstood it.

"Bob Phillips" wrote in message
...
A listbox is a listbox, a control is a more generic term for the
controls
on a form. So a listbox is a listbox, a textbox is a textbox, but both
are
also controls.

You can test the controls collection for the control type


For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "CommandButton": MsgBox ctl.Caption
Select Case TypeName(ctl)
Case "TextBox": MsgBox ctl.Value
Select Case TypeName(ctl)
Case "Label": MsgBox ctl.Caption
'etc.
Next


--

HTH

Bob

"KC" wrote in message
...
I have this multipage userform, containing 16 listboxes in 16 pages.
page0 has no listbox.
Whenever an item is selected in one of these listboxes, some 30 lines
of
code is needed to process that item.
The original code thus contained 16 x 30 lines of code.

It took me 2 years on and off to construct a loop to do the same
stuff,
in about 40 lines of code.
It turns out that each list box is not a list box, it is a control.
Its position has nothing to do with page number, which in turn is
multipage.value

Amazing






.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Multipage TotallyConfused Excel Programming 3 December 5th 07 06:01 PM
Multipage Userform mjack003[_18_] Excel Programming 1 December 31st 05 10:17 AM
Multipage on a userform browie Excel Programming 3 June 15th 05 01:34 AM
Problems with the userform multipage Wilbo Excel Programming 1 October 19th 04 09:09 AM
MultiPage UserForm Michael J. Malinsky Excel Programming 2 July 16th 03 01:02 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"