Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Useform won't Show with dynamically added controls
Hi there
Using Windows XP, Excel 2003 I have created a userform to which I dynamically add controls as my vba program runs. Having tested it, all the controls are added correctly (and later deleted). However, when I next added the line Myuserform.Show in order to display the form, I obtain the error: "Invalid forward reference, or reference to uncompiled type". When I step through the program again the error occurs once I try to add the first control to the form before I even try and show the form. Does anyone know what is going on here please and how to fix it? Many Thanks Lloyd |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Useform won't Show with dynamically added controls
First, I've never seen this error -- so everything I suggest is gonna be a guess.
Have you tried compiling the project (Debug|Compile in the VBE)? Do you use any non-builtin controls or are they all the "normal" controls? Your answers won't help me, but maybe they'll help some other potential responder. On 08/31/2010 07:15, pinkfloydfan wrote: Hi there Using Windows XP, Excel 2003 I have created a userform to which I dynamically add controls as my vba program runs. Having tested it, all the controls are added correctly (and later deleted). However, when I next added the line Myuserform.Show in order to display the form, I obtain the error: "Invalid forward reference, or reference to uncompiled type". When I step through the program again the error occurs once I try to add the first control to the form before I even try and show the form. Does anyone know what is going on here please and how to fix it? Many Thanks Lloyd -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Useform won't Show with dynamically added controls
Hi Dave
I have tried Debut/Compile and running it again and that makes no difference. I am only adding a series of built-in checkboxes and labels. The weird thing is that if I comment out the line "Myuserform.Show" it does what it's supposed to do...once that line is added in then it crashes as soon as I try and add the first control. I am completely lost now! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Useform won't Show with dynamically added controls
This may not work for you, but if you remove the code that adds the controls,
can you show the userform successfully? If yes, maybe you could add the controls, but hide them when the form loads. Then show them later (instead of adding them). On 08/31/2010 09:45, pinkfloydfan wrote: Hi Dave I have tried Debut/Compile and running it again and that makes no difference. I am only adding a series of built-in checkboxes and labels. The weird thing is that if I comment out the line "Myuserform.Show" it does what it's supposed to do...once that line is added in then it crashes as soon as I try and add the first control. I am completely lost now! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to execute a dynamically added or changed module | Excel Programming | |||
Can you dynamically expand the time range to the series data added | Charts and Charting in Excel | |||
Dynamically Added Control | Excel Programming | |||
add controls on the fly/dynamically | Excel Discussion (Misc queries) | |||
Event procedures for controls added with Controls.Add | Excel Programming |