Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default UserForm ListBox Height

I am creating an application that uses a number of UserForms, most with
multiple listboxes. The listboxes are initially set up in what I view at the
best default layout of position and size. Prior to showing I check some
parameters and change the size accordingly. Some simple sample code:

Load UserForm1

If NumberOfListBoxes=4 Then
With UserForm1.ListBox1
..Caption="Some New Text"
If SomeOtherFactor=True Then
..Height=200
End If
End With
End If

UserForm1.Show

The problem is that the height changes are not being made consistently, even
though I know that this portion of the code is run. Am I doing something
amaturish that does not insure that the change is made? Any help would be
appreciated. Thank you.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default UserForm ListBox Height

The only thing that I see is the If condition. SomeOtherFactor has to be
True for the height to change. Have you stepped through the code to see if
SomeOtherFactor = True when the height does not change?

"ZipCurs" wrote:

I am creating an application that uses a number of UserForms, most with
multiple listboxes. The listboxes are initially set up in what I view at the
best default layout of position and size. Prior to showing I check some
parameters and change the size accordingly. Some simple sample code:

Load UserForm1

If NumberOfListBoxes=4 Then
With UserForm1.ListBox1
.Caption="Some New Text"
If SomeOtherFactor=True Then
.Height=200
End If
End With
End If

UserForm1.Show

The problem is that the height changes are not being made consistently, even
though I know that this portion of the code is run. Am I doing something
amaturish that does not insure that the change is made? Any help would be
appreciated. Thank you.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default UserForm ListBox Height

JLGWhiz,

Thanks for looking at this. I have put a Stop after the .Height=200, and
the value is indeed 200. It just doesn't consisently change the actually
box. On one UserForm, I am actually setting the condition on 4 different
listboxes. Sometimes, all will change length, sometime none, sometimes one
or two. It really seems to be a matter of consistency.

I see similar issues with setting the value occasionally. This one is even
wierder in that the listbox highlighted item, but does not seem to
acknowledge it when queried.

Again, any help or insight would be greatly appreciated. Thank you.

"JLGWhiz" wrote:

The only thing that I see is the If condition. SomeOtherFactor has to be
True for the height to change. Have you stepped through the code to see if
SomeOtherFactor = True when the height does not change?

"ZipCurs" wrote:

I am creating an application that uses a number of UserForms, most with
multiple listboxes. The listboxes are initially set up in what I view at the
best default layout of position and size. Prior to showing I check some
parameters and change the size accordingly. Some simple sample code:

Load UserForm1

If NumberOfListBoxes=4 Then
With UserForm1.ListBox1
.Caption="Some New Text"
If SomeOtherFactor=True Then
.Height=200
End If
End With
End If

UserForm1.Show

The problem is that the height changes are not being made consistently, even
though I know that this portion of the code is run. Am I doing something
amaturish that does not insure that the change is made? Any help would be
appreciated. Thank you.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default UserForm ListBox Height

In the absense of any help, I added a DoEvents after .Height=200. No very
satisfying but it works.

"ZipCurs" wrote:

JLGWhiz,

Thanks for looking at this. I have put a Stop after the .Height=200, and
the value is indeed 200. It just doesn't consisently change the actually
box. On one UserForm, I am actually setting the condition on 4 different
listboxes. Sometimes, all will change length, sometime none, sometimes one
or two. It really seems to be a matter of consistency.

I see similar issues with setting the value occasionally. This one is even
wierder in that the listbox highlighted item, but does not seem to
acknowledge it when queried.

Again, any help or insight would be greatly appreciated. Thank you.

"JLGWhiz" wrote:

The only thing that I see is the If condition. SomeOtherFactor has to be
True for the height to change. Have you stepped through the code to see if
SomeOtherFactor = True when the height does not change?

"ZipCurs" wrote:

I am creating an application that uses a number of UserForms, most with
multiple listboxes. The listboxes are initially set up in what I view at the
best default layout of position and size. Prior to showing I check some
parameters and change the size accordingly. Some simple sample code:

Load UserForm1

If NumberOfListBoxes=4 Then
With UserForm1.ListBox1
.Caption="Some New Text"
If SomeOtherFactor=True Then
.Height=200
End If
End With
End If

UserForm1.Show

The problem is that the height changes are not being made consistently, even
though I know that this portion of the code is run. Am I doing something
amaturish that does not insure that the change is made? Any help would be
appreciated. Thank you.


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
Listbox Height Question Norm Lundquist Excel Programming 6 May 9th 07 11:08 PM
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
Userform height not consistent? RB Smissaert Excel Programming 2 March 16th 05 01:55 PM
Wanted func to determine height of ListBox row count Excel Programming 2 May 24th 04 06:38 PM
UserForm Change Of Height Rockee052[_57_] Excel Programming 3 March 6th 04 07:47 AM


All times are GMT +1. The time now is 12:02 AM.

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

About Us

"It's about Microsoft Excel"