Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate Textbox value based on another textbox value.doc | Excel Discussion (Misc queries) | |||
Calculate Textbox value based on another textbox value | Excel Discussion (Misc queries) | |||
Dynamic update of UserForm TextBox | Excel Programming | |||
Dynamic TextBox ActiveX events | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |