Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Textbox added to Form at runtime too small, can't control size andchange event won't trigger

I have Form and when the user clicks CommandButton4 a textbox is added
to the form with the code below. When I type in the textbox it
resizes itself really small and you can only view a small amount of
the text typed into the box. Also, when I type in the box the change
event does trigger the msgbox. Does anyone know how to make this
textbox resize so the user can see all the text typed in the box?

Private Sub CommandButton4_Click()
Dim ctrl As msforms.TextBox
With Me
Set ctrl = .Controls.Add("forms.textbox.1", "txt1", True)
ctrl.Left = 20
ctrl.Top = 50
ctrl.AutoSize = True
ctrl.MultiLine = True
ctrl.WordWrap = True
ctrl.Visible = True
End With
End Sub

Private Sub txt1_change()
MsgBox "txt1 has changed"
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Textbox added to Form at runtime too small, can't control size and

Hi,

Rather than create the textbox on the fly, why not create it ahead of time
and then hide it. When the user clicks their button display the textbox.


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"RCGUA" wrote:

I have Form and when the user clicks CommandButton4 a textbox is added
to the form with the code below. When I type in the textbox it
resizes itself really small and you can only view a small amount of
the text typed into the box. Also, when I type in the box the change
event does trigger the msgbox. Does anyone know how to make this
textbox resize so the user can see all the text typed in the box?

Private Sub CommandButton4_Click()
Dim ctrl As msforms.TextBox
With Me
Set ctrl = .Controls.Add("forms.textbox.1", "txt1", True)
ctrl.Left = 20
ctrl.Top = 50
ctrl.AutoSize = True
ctrl.MultiLine = True
ctrl.WordWrap = True
ctrl.Visible = True
End With
End Sub

Private Sub txt1_change()
MsgBox "txt1 has changed"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Textbox added to Form at runtime too small, can't control sizeand

On Dec 10, 2:26*pm, Shane Devenshire
wrote:
Hi,

Rather than create the textbox on the fly, why not create it ahead of time
and then hide it. *When the user clicks their button display the textbox. *

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire

Thanks for your reply. The user is allowed to create up to 99 text
boxes on the form so that is why I was hoping to create them on the
fly rather than create 99 invisible textboxes. However, if the group
knowledge is that this is the only way to do, then I will create 99
invisible textboxes.


"RCGUA" wrote:
I have Form and when the user clicks CommandButton4 a textbox is added
to the form with the code below. *When I type in the textbox it
resizes itself really small and you can only view a small amount of
the text typed into the box. *Also, when I type in the box the change
event does trigger the msgbox. *Does anyone know how to make this
textbox resize so the user can see all the text typed in the box?


Private Sub CommandButton4_Click()
Dim ctrl As msforms.TextBox
* * With Me
* * * * Set ctrl = .Controls.Add("forms.textbox.1", "txt1", True)
* * * * ctrl.Left = 20
* * * * ctrl.Top = 50
* * * * ctrl.AutoSize = True
* * * * ctrl.MultiLine = True
* * * * ctrl.WordWrap = True
* * * * ctrl.Visible = True
* * End With
End Sub


Private Sub txt1_change()
MsgBox "txt1 has changed"
End Sub- Hide quoted text -


- Show quoted text -


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
Textbox added to Form at runtime too small, can't control size andchange event won't trigger RCGUA Excel Worksheet Functions 0 December 10th 08 07:48 PM
Trigger Event on Format Change Zone[_3_] Excel Discussion (Misc queries) 4 August 25th 07 05:43 PM
Action Event, CheckBox, Add Row and Textbox Ryan Excel Discussion (Misc queries) 2 July 17th 07 02:32 PM
How can I expose the TextBox BeforeUpdate event to my user class? bereid Excel Discussion (Misc queries) 0 November 30th 05 05:00 PM


All times are GMT +1. The time now is 09:45 AM.

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"