Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default dynamic textbox??

Can i add textboxes dynamically?? I tried through the
generic code for optionbutton/Checkboxes in a dialog
sheet. it failed as I cannot write anythign on the text
box created.

would appreciate if anyone can suggest.

thanks for the help.

I tried the following 2 ways
1: For i = 1 To 2
iBooks = iBooks + 1
PrintDlg.textBoxes.Add 78, TopPos, 150, 16.5
TopPos = TopPos + 13
Next i
PrintDlg.Buttons.Left = 240

CurrentSheet.Activate
With PrintDlg.DialogFrame
.Height = Application.Max _
(68, PrintDlg.DialogFrame.Top + TopPos - 34)
.Width = 230
.Caption = "Enter worksheet Names to create"
End With
PrintDlg.Buttons("Button 2").BringToFront
PrintDlg.Buttons("Button 3").BringToFront

PrintDlg.Show
If Not cb.Text = "" Then
Str = cb.Text
End If

PrintDlg.Delete
2. Me.Controls.Add (TextBox)..in form
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default dynamic textbox??

Not sure about the dialogbox, will look into that, but here is some code
showing how to add con trols to a userform

Private Sub CommandButton1_Click()
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

Note that you still have a problem of adding code behind the control. AN
alternative approach is to add the control and code at design, but hide it
until you need it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
...
Can i add textboxes dynamically?? I tried through the
generic code for optionbutton/Checkboxes in a dialog
sheet. it failed as I cannot write anythign on the text
box created.

would appreciate if anyone can suggest.

thanks for the help.

I tried the following 2 ways
1: For i = 1 To 2
iBooks = iBooks + 1
PrintDlg.textBoxes.Add 78, TopPos, 150, 16.5
TopPos = TopPos + 13
Next i
PrintDlg.Buttons.Left = 240

CurrentSheet.Activate
With PrintDlg.DialogFrame
.Height = Application.Max _
(68, PrintDlg.DialogFrame.Top + TopPos - 34)
.Width = 230
.Caption = "Enter worksheet Names to create"
End With
PrintDlg.Buttons("Button 2").BringToFront
PrintDlg.Buttons("Button 3").BringToFront

PrintDlg.Show
If Not cb.Text = "" Then
Str = cb.Text
End If

PrintDlg.Delete
2. Me.Controls.Add (TextBox)..in form



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
Calculate Textbox value based on another textbox value.doc Tdungate Excel Discussion (Misc queries) 1 February 12th 09 07:11 PM
Calculate Textbox value based on another textbox value Tdungate Excel Discussion (Misc queries) 0 February 12th 09 07:03 PM
Dynamic update of UserForm TextBox Tom_C Excel Programming 7 January 15th 04 06:58 PM
Dynamic TextBox ActiveX events Tom Ogilvy Excel Programming 0 September 29th 03 08:56 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 12:24 PM.

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"