LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Add controls to Frames at Runtime

This was just show you how to add other controls. You will need to add into
your code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Neily" wrote in message
...
Hi Bob,

Thanks for the reply. What does this code do? Is that just to add

controls
to the form?

What I'm trying to acheive is to create a Frame at runtime (which I have
from the original post) and then, still at run time, add 2 Option Buttons

to
that frame so that they are grouped using that frame.

You know how I can do that?

Ta.

Neil

"Bob Phillips" wrote:

Neily,

Here is some example code

Private Sub CreateControl()
Dim newButton As msforms.Control
Select Case True
Case chkText.Value
Set newButton = Me.Controls.Add("Forms.Textbox.1")
newButton.Name = "New Textbox"
Case chkButton.Value
Set newButton = Me.Controls.Add("Forms.CommandButton.1")
newButton.Caption = "newCmd"
Case chkCheckbox.Value
Set newButton = Me.Controls.Add("Forms.Checkbox.1")
newButton.Caption = "Another Checkbox"
End Select

With newButton
.Left = 100
.Top = 50
.Visible = True
End With

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Neily" wrote in message
...
Hi,

I am using the following code to add a frame to a form..
Set AddMyControl = Controls.Add("Forms.Frame.1", "fraFrame1",

Visible)
AddMyControl.Left = 50
AddMyControl.Top = 50
AddMyControl.Caption = "New Frame Box"
AddMyControl.Width = 70
AddMyControl.Height = 50

I then want to add, say a checkbox into that frame. Anybody done this
before, got any ideas how it codes?

Thanks.






 
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
Userform runtime controls & Macs Jim Cowan Excel Programming 0 June 15th 05 07:21 PM
Removing Controls at RunTime? Neily[_3_] Excel Programming 1 November 25th 04 02:17 PM
How to create controls at runtime Andy Chan Excel Programming 3 August 30th 04 10:07 AM
Add Controls With Events at Runtime llowwelll Excel Programming 10 May 24th 04 11:52 AM
creating controls at runtime defj Excel Programming 2 December 2nd 03 07:14 AM


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