View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Spell Checking Text Boxes?

I'm not sure what textboxes you're using.

I put a couple of textboxes from the Drawing toolbar onto a worksheet. I put a
couple of buttons from the Forms toolbar onto the sheet (adjacent to the
textboxes).

But I named each nicely.

the buttons were named: button_001 and button_002
the textboxes were named: textbox_001 and textbox_002

Then I could use those suffixes from the button's name to determine which
textbox to spellcheck.

I put this in a general module:

Option Explicit
Sub testme()

Dim myBTN As Button
Dim mySFX As String
Dim myTB As TextBox

Set myBTN = ActiveSheet.Buttons(Application.Caller)
mySFX = Right(myBTN.Name, 3)
Set myTB = ActiveSheet.TextBoxes("TextBox_" & mySFX)

myTB.CheckSpelling

End Sub

And assigned it to both buttons.



Don Wiss wrote:

My text boxes are now all from the Shapes or Forms toolbars. I believe the
objects are the same. Alongside each box I have a button for spell
checking. The macro the button called had the text box's name to know which
to select and check. The sheet is protected. I thought I could have a
single macro that with Selection.Name could determine where the user was
and then use that to select the shape to check. But it seems that when
protected you can't read the Selection.Name.

Okay, so I can go back to my old way. But even then it is less than
perfect. After checking the spelling the textbox is left with the fuzzy
line around it. When the user leaves the box it does go away, but returns
when the box is reselected. The box is no longer protected. It can be
moved. But only once. Then this goes away and it becomes a normal protected
box.

I then decided to see what a text box from the control toolbox would do. Of
course this means much more complexity. I created a box. It has WordWrap =
True. MultiLine = True. EnterKeyBehavior = True. SelectionMargin = False.
One quirk I see is if there is more text than can be shown, the hidden text
is from the top. Then why does the box and text increase in size slightly
when selected? And then I get back to my original question and just how
would I spell check these?

Don <donwiss at panix.com.


--

Dave Peterson