View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Souny Souny is offline
external usenet poster
 
Posts: 40
Default Question on Form Textboxes

Rick,

Thank you very much for continuing to help me and for your code. Your code
works perfectly.

"Rick Rothstein" wrote:

I have no idea how to reproduce your "Forms" TextBoxes in my copy of XL2003,
so (since you said they were not from the Control Toolbox) I used TextBoxes
from the Drawing toolbar and here is the code I came up with to change their
LockedText properties. If this doesn't work straightaway on your particular
TextBoxes, perhaps you can use it as a guide...

Sub TurnLockedTextOn()
Dim SH As Worksheet, TB As Shape
For Each SH In ActiveWorkbook.Worksheets
If SH.Shapes.Count Then
For Each TB In SH.Shapes
If TB.Type = msoTextBox Then
TB.ControlFormat.LockedText = True
End If
Next
End If
Next
End Sub

--
Rick (MVP - Excel)


"Souny" wrote in message
...
Rick,

Thanks for your response. I have this Excel file for years. I remember
correctly that I got those Text Boxes from the Forms toolbar. Now when I
look for it on the Forms toolbar, I do not find it. Those Text Boxes are
not
from the Control Toolbox toolbar.

One of the differences between Forms Text Box and Control Toolbox Text Box
is Forms has a feather for Assign Macro and Control has a feather for View
Code on the right-click menu.

In any case, could you help me with the code?

When I click on the command button, I would like to have the Lock Text
activated. In the Format Text Box property window, there is a checkbox
"Lock
Text". I would like that box to be checked when I click on the command
button.

Thanks.

"Rick Rothstein" wrote:

You are going to have to clarify this statement for us...

"I have Form type Text Boxes"

There are no TextBoxes on the Forms toolbar... only the Controls Toolbox
toolbar or the Drawing toolbar. So, where did you get your TextBox from?

--
Rick (MVP - Excel)


"Souny" wrote in message
...
Hello all,

In every worksheet of my Excel file, I have Form type Text Boxes. I
need
help with activating the Locked Text of those text boxes when I click
on
the
command button. Could you please help me?

Below is the code I currently have, and it's not working.

Dim objT As OLEObject
Dim sh As Worksheet
For Each sh In Activeworkbook.Worksheets
For Each objT In sh.OLEObjects
If objT.OLEType = xlOLEEmbed Then
objT.LockedText = True
End If
Next objT
Next sh

Thanks.


.


.