Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Adding controls to a userform at runtime

I've always had better luck to add all the controls that I'll ever need while in
design mode.

But I'll hide the ones I don't need. Then I can use code to show the ones I
need when I need them.

It makes it easier for the code associated with those controls, too.

AlanGriffithKapitiNZ wrote:

I would like to generate various controls on a skeleton userform (eg, the
number may vary with the occasion) and have tried
Private Sub UserForm_activate()
Stop
Dim obj As Object
Set obj = Me
Set obj = obj.Add("MSForms.CommandButton.1", "Butt1", True)

but when the form opens I receive the error message
Runtime error '-2147221005(800401f3':
Invalid class string

What am I doing wrong, please?


--

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
Need help with adding Controls and event handlers at runtime [email protected] Excel Programming 0 December 27th 06 04:36 PM
Need help with adding Controls and event handlers at runtime [email protected] Excel Programming 0 December 27th 06 04:36 PM
Adding controls to a form at runtime Todd Huttenstine Excel Programming 0 March 23rd 06 03:29 PM
adding controls to userform at runtime Ouka[_12_] Excel Programming 3 August 18th 05 08:11 PM
Userform runtime controls & Macs Jim Cowan Excel Programming 0 June 15th 05 07:21 PM


All times are GMT +1. The time now is 11:36 PM.

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"