Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Working with Excel 97.
I have some code that will resize a form and a listbox based on the number of columns the listbox will have. We'll call this Form1. When I first load Form1, the listbox's width is set correctly. However, it seems that other forms that I view affect the listbox- we'll call this Form2. I'll load and unload Form2 and then reload Form1, but now the listbox will not change it's width properly. The form changes without problem. I put in a test button to show me what the listbox's width is set to, and it tells me that the listbox is correctly set to it's proper width. I then select any item in the listbox and click the test button and now it tells me the "actual" width of the listbox. So, in the code for the test button I put in some code to set the width of the listbox, and again it tells me that it has properly set the width, but when I select an item, I'm now told what the "actual" width is. I then added code to the test button to set the focus to the listbox and to select an item, but it still doesn't want to resize. It seems something from Form2 is affecting Form1 in some matter. Not all forms do this and I can't tell what's different from the forms that do affect the listbox as opposed to those that do? Form2 does have a combobox on it, whereas the other forms do not. (I removed the comboboxes, but it didn't make any difference) Any one have a clue to why this is? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the code to resize the listbox is in the userform_initialize() function,
then this only fires once, when the form is first created. If you then hide the form and show it again, the initialize event does not file. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... Working with Excel 97. I have some code that will resize a form and a listbox based on the number of columns the listbox will have. We'll call this Form1. When I first load Form1, the listbox's width is set correctly. However, it seems that other forms that I view affect the listbox- we'll call this Form2. I'll load and unload Form2 and then reload Form1, but now the listbox will not change it's width properly. The form changes without problem. I put in a test button to show me what the listbox's width is set to, and it tells me that the listbox is correctly set to it's proper width. I then select any item in the listbox and click the test button and now it tells me the "actual" width of the listbox. So, in the code for the test button I put in some code to set the width of the listbox, and again it tells me that it has properly set the width, but when I select an item, I'm now told what the "actual" width is. I then added code to the test button to set the focus to the listbox and to select an item, but it still doesn't want to resize. It seems something from Form2 is affecting Form1 in some matter. Not all forms do this and I can't tell what's different from the forms that do affect the listbox as opposed to those that do? Form2 does have a combobox on it, whereas the other forms do not. (I removed the comboboxes, but it didn't make any difference) Any one have a clue to why this is? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is in the UserForm_Activate() function. I also don't hide it at any
point, it's always Unloaded. The form itself resizes to accomodate the width of the listbox, but the listbox doesn't resize. "Tom Ogilvy" wrote in message ... If the code to resize the listbox is in the userform_initialize() function, then this only fires once, when the form is first created. If you then hide the form and show it again, the initialize event does not file. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... Working with Excel 97. I have some code that will resize a form and a listbox based on the number of columns the listbox will have. We'll call this Form1. When I first load Form1, the listbox's width is set correctly. However, it seems that other forms that I view affect the listbox- we'll call this Form2. I'll load and unload Form2 and then reload Form1, but now the listbox will not change it's width properly. The form changes without problem. I put in a test button to show me what the listbox's width is set to, and it tells me that the listbox is correctly set to it's proper width. I then select any item in the listbox and click the test button and now it tells me the "actual" width of the listbox. So, in the code for the test button I put in some code to set the width of the listbox, and again it tells me that it has properly set the width, but when I select an item, I'm now told what the "actual" width is. I then added code to the test button to set the focus to the listbox and to select an item, but it still doesn't want to resize. It seems something from Form2 is affecting Form1 in some matter. Not all forms do this and I can't tell what's different from the forms that do affect the listbox as opposed to those that do? Form2 does have a combobox on it, whereas the other forms do not. (I removed the comboboxes, but it didn't make any difference) Any one have a clue to why this is? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you are showing one form from this form, then the first form never
unloads because it still has an event running. I suspect this kind of error is a least a factor in your problem. Put a message box in the code that resizes the listbox and see if that code (the resize code) is actually being executed to produce the results you expect. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... It is in the UserForm_Activate() function. I also don't hide it at any point, it's always Unloaded. The form itself resizes to accomodate the width of the listbox, but the listbox doesn't resize. "Tom Ogilvy" wrote in message ... If the code to resize the listbox is in the userform_initialize() function, then this only fires once, when the form is first created. If you then hide the form and show it again, the initialize event does not file. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... Working with Excel 97. I have some code that will resize a form and a listbox based on the number of columns the listbox will have. We'll call this Form1. When I first load Form1, the listbox's width is set correctly. However, it seems that other forms that I view affect the listbox- we'll call this Form2. I'll load and unload Form2 and then reload Form1, but now the listbox will not change it's width properly. The form changes without problem. I put in a test button to show me what the listbox's width is set to, and it tells me that the listbox is correctly set to it's proper width. I then select any item in the listbox and click the test button and now it tells me the "actual" width of the listbox. So, in the code for the test button I put in some code to set the width of the listbox, and again it tells me that it has properly set the width, but when I select an item, I'm now told what the "actual" width is. I then added code to the test button to set the focus to the listbox and to select an item, but it still doesn't want to resize. It seems something from Form2 is affecting Form1 in some matter. Not all forms do this and I can't tell what's different from the forms that do affect the listbox as opposed to those that do? Form2 does have a combobox on it, whereas the other forms do not. (I removed the comboboxes, but it didn't make any difference) Any one have a clue to why this is? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This form is not calling another form. I can open and close this form
repeatedly and it will resize the listbox. When I open other forms, they are affecting the resizing of the listbox in a way I'm not sure how. I put in a msgbox as you said, and when I re-open the form with the listbox, the listbox.width tells me the width it's "supposed" to be, but you can visually see that it doesn't resize. Once I've selected an item in the listbox, the true width is revealed ( the width that at design time). I even put in a button to set the listbox width directly, and it doesn't resize. Thanks for the input! Keep it coming! I'm going to knock this out one way or another! "Tom Ogilvy" wrote in message ... If you are showing one form from this form, then the first form never unloads because it still has an event running. I suspect this kind of error is a least a factor in your problem. Put a message box in the code that resizes the listbox and see if that code (the resize code) is actually being executed to produce the results you expect. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... It is in the UserForm_Activate() function. I also don't hide it at any point, it's always Unloaded. The form itself resizes to accomodate the width of the listbox, but the listbox doesn't resize. "Tom Ogilvy" wrote in message ... If the code to resize the listbox is in the userform_initialize() function, then this only fires once, when the form is first created. If you then hide the form and show it again, the initialize event does not file. -- Regards, Tom Ogilvy "Nick Burns" wrote in message ... Working with Excel 97. I have some code that will resize a form and a listbox based on the number of columns the listbox will have. We'll call this Form1. When I first load Form1, the listbox's width is set correctly. However, it seems that other forms that I view affect the listbox- we'll call this Form2. I'll load and unload Form2 and then reload Form1, but now the listbox will not change it's width properly. The form changes without problem. I put in a test button to show me what the listbox's width is set to, and it tells me that the listbox is correctly set to it's proper width. I then select any item in the listbox and click the test button and now it tells me the "actual" width of the listbox. So, in the code for the test button I put in some code to set the width of the listbox, and again it tells me that it has properly set the width, but when I select an item, I'm now told what the "actual" width is. I then added code to the test button to set the focus to the listbox and to select an item, but it still doesn't want to resize. It seems something from Form2 is affecting Form1 in some matter. Not all forms do this and I can't tell what's different from the forms that do affect the listbox as opposed to those that do? Form2 does have a combobox on it, whereas the other forms do not. (I removed the comboboxes, but it didn't make any difference) Any one have a clue to why this is? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
weird! Excel refuses to compute numbers... | Excel Discussion (Misc queries) | |||
excel refuses to open | Excel Discussion (Misc queries) | |||
cell format refuses to be changed | Excel Discussion (Misc queries) | |||
Run-Time code refuses to work in Windows XP | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming |