Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Multiple Activex TextBox on sheet auto size and move

I have a sheet with 6 text boxes one under the other. I would like to start
each box vertically sized to contain one row of data - then as the user types
it autosizes vertically to fit what has been typed - while this is happening
the boxes below it will move their position downward but keep the same
spacing between them - any ideas on code? THANKS!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Multiple Activex TextBox on sheet auto size and move

Try the following in the sheet module

Const mcTB_WD As Single = 99

Private Sub TextBox1_Change()
TBwidth TextBox1
End Sub

Private Sub TextBox2_Change()
TBwidth TextBox2
End Sub

Private Sub TextBox3_Change()
TBwidth TextBox3
End Sub

Private Sub TBwidth(oTB As msforms.TextBox)
With oTB
If .Width < mcTB_WD Then .Width = mcTB_WD
End With
End Sub


Private Sub TBoxProps()
Dim ole As OLEObject
For Each ole In Me.OLEObjects
If InStr(1, ole.progID, "TextBox") Then
ole.Object.MultiLine = True
ole.Object.AutoSize = True
ole.Object.WordWrap = True
ole.Width = mcTB_WD
If Len(ole.Object.Text) < 5 Then
' ole.Height = 18
End If
End If
Next
End Sub

Manually run TBoxProps to set the properties. Apart from autosize, multilne
& wrap adjust other properties to your needs.

Regards,
Peter T


"Kenny" wrote in message
...
I have a sheet with 6 text boxes one under the other. I would like to start
each box vertically sized to contain one row of data - then as the user
types
it autosizes vertically to fit what has been typed - while this is
happening
the boxes below it will move their position downward but keep the same
spacing between them - any ideas on code? THANKS!



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
Move and size a object on the sheet Riddler Excel Programming 1 November 2nd 07 10:11 PM
How to move cursor from one textbox control to another textbox con Tom Ogilvy Excel Programming 1 September 16th 04 03:42 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM
ActiveX Textbox question Stuart[_5_] Excel Programming 3 July 11th 04 07:02 PM
TextBox Properties -- Don't move and size with cells Fred Holmes Excel Programming 1 September 4th 03 10:45 PM


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