Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default MSForm 2 - Creating labels and text boxes at run time

Is CreateObject used to place a new label or text box onto a form at run
time? All I could find in the examples is how to create applications or
workbooks:
Set xlApp = CreateObject("Excel.Application")

Thanks in advance,
-Tim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default MSForm 2 - Creating labels and text boxes at run time

No, here is an example

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


--

HTH

RP

"Tim Coddington" wrote in message
...
Is CreateObject used to place a new label or text box onto a form at run
time? All I could find in the examples is how to create applications or
workbooks:
Set xlApp = CreateObject("Excel.Application")

Thanks in advance,
-Tim




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default MSForm 2 - Creating labels and text boxes at run time - My thanks

AAAAAH. Thanks, Bob!
"Bob Phillips" wrote in message
...
No, here is an example

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


--

HTH

RP

"Tim Coddington" wrote in message
...
Is CreateObject used to place a new label or text box onto a form at run
time? All I could find in the examples is how to create applications or
workbooks:
Set xlApp = CreateObject("Excel.Application")

Thanks in advance,
-Tim






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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Excel 2007 text labels in category axis - missing labels Boris Charts and Charting in Excel 3 December 5th 08 04:33 PM
Data labels switch to text boxes on negative values Cooter Charts and Charting in Excel 3 May 1st 08 09:42 PM
XL97: Position text boxes (or data labels) w/out VBA LeAnne Charts and Charting in Excel 1 December 1st 05 09:07 PM
MSForm 1 - Initial placement of form Tim Coddington Excel Programming 2 October 1st 04 03:05 PM


All times are GMT +1. The time now is 11:19 AM.

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"