Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default 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
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
How to execute a dynamically added or changed module [email protected] Excel Programming 1 March 5th 10 12:24 PM
Can you dynamically expand the time range to the series data added Rubbs Charts and Charting in Excel 2 December 5th 07 04:06 PM
Dynamically Added Control BobT Excel Programming 3 May 31st 07 07:31 PM
add controls on the fly/dynamically jinx_uk_98 Excel Discussion (Misc queries) 3 November 21st 05 10:46 PM
Event procedures for controls added with Controls.Add John Austin[_4_] Excel Programming 1 March 9th 05 03:31 PM


All times are GMT +1. The time now is 01:34 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"