View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_21_] Stuart[_21_] is offline
external usenet poster
 
Posts: 154
Default Textbox questions

Many thanks for the help.
Will post back if problems remain.

Regards.

"K Dales" wrote in message
...
Yes to both.
1) Do you mean a textbox on a userform? Copying is straightforward:
UserForm1.TextBox1 = Sheets("Sheet1").OLEObjects("TextBox1").Object.Val ue
Forms toolbar does not allow me (in XP) to create a textbox on a sheet -
If
you mean a textbox from the drawing toolbar, then to get the text (left
side
of above equation) it would be:
Sheets("Sheet1").Shapes("Text Box 1").TextFrame.Characters.Text
If it is indeed a Forms control (earlier version of Excel?) then it would
be:
Sheets("Sheet1").Shapes("TextBox1").ControlFormat. Value

2) Again, assuming you are talking about a Userform, any control has a
top,
left, height and width property that you can use to set size and position,
in
points. You can do the same with Shape objects on a worksheet (including
both the forms controls and ActiveX controls, since both are "contained"
in a
Shape).

"Stuart" wrote:

2 questions, please:

1. Can I copy the contents of an ActiveX textbox on a
sheet to a textbox created from the forms toolbar?

2. Can I establish (in points) the top left corner of the
form's textbox, relative to the top left corner of the
form itself?

Regards.