View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_5_] Stuart[_5_] is offline
external usenet poster
 
Posts: 413
Default Can I do this with a TextBox?

Thanks again.
I originally tried an ActiveX textbox (which seemed fine to me),
until my co-users insisted they wanted to run Spelling (F7) on it.
I then found that CheckSpelling won't work on that type of
textbox.
I think I found code for the technique you mention (ie to
split the textbox contents into individual words, and then to
checkspell them), but as you say, there are no helpful
suggestions for anything mispelled.
That's the main reason I changed to a textbox from the
Drawing toolbar....and I'm beginning to discover some of
the limitations!

One last question please:
How can I obtain a list of the Event options associated
with a textbox .... (and that goes for Objects/Controls
generally)? I'm sure I've seen a way to do this as soon
as the textbox (eg) is created?

So if I found a (say) Textbox_Deactivate or Deselect
event, I might be able to use that to check the cell the
user had exited to, and test that for being locked ......
if so, return user to the textbox.

Regards and thanks.

"Dick Kusleika" wrote in message
...

"Stuart" wrote in message
...

3 questions, please:

1. The textbox is positioned over the range "C26:L65". When the user

exits,
CheckSpelling runs on the textbox, then prompts to check the rest of

the
sheet. Can this be turned off?


Unfortunately, no. See below for another option.

2. When the user initially clicks within the textbox, the cursor is not
visible.
It's only after a second click that it appears. Can it appear the

first
time?


I hadn't realized that that was happening, but I confirmed that it does.

I
tried various things to get it show, but couldn't come up with anything.

3. Can the tab key be enabled?


Inside the textbox? Control+tab can be used to tab inside the textbox.

As you've seen, there are some drawbacks to this spell check method. I
found a few more, like deselecting the textbox by selecting a protected

cell
causes an error. That error can be trapped, I think, but it's a flaw in

the
code that I gave you.

We're using the CheckSpelling method on a range object. You can also use
the CheckSpelling method of the Application object which will get rid of
some of those problems. However, it presents a whole new set of problems
and some additional coding. For instance, it only checks one word at a
time, so you have to split the text from the textbox into words and run

the
method on those words. Doing this does not show the dialog with the
suggestions, it merely returns a True or False depending on the outcome of
the check.

Let me know if you want to investigate this alternative method.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.727 / Virus Database: 482 - Release Date: 27/07/2004