Better Spellcheck Macro or a Other Solution

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Better Spellcheck Macro or a Other Solution

Post by arroway »

I have a few locked Word docuement forms with a spellcheck macro included which runs from a macro button. When the spellcheck runs, mispelled words are highlighted in red and suggestions are offered (as it normally is). If the user hits the Change button and accepts the suggestion, all is well. But if the user clicks into the Not in Dictionary field, makes edits there, then hits the change button, this throws an error. This doesn't happen all the time but sometimes. And when this happens, if the debugger is just stopped (because my users don't knwo what to do with it) the form is the left unlocked and they go on to what they think is filling in the form when what they're actually doing is replacing the form fields with text, which throws everything all out of whack! This doesn't happen all that often but occurs often enough that I'm seeking help for it cuz my users are starting to bug me too much. I've gotten them to come call me when the error comes up and what I do is relock the form with the correct password (and I'm not giving them the password or teaching them how to do this).

I'm wondering if it's a bug in the Spellchecker or if it has something to do with the Spellcheck macro I'm using which might be outdated, which, by the way, is Dave Rado, Bill Coan, Astrid Zeelenberg, Dan Monk, and Geoff Whitfield's spellchecker available here: http://word.mvps.org/FAQs/MacrosVBA/Spe ... ectDoc.htm.

Do you think it's the spellchecker or could it be the code. If it's the code, is there other better spellchecker code out there? And if it's the spellchecker, have you heard of any fixes?

Thanks for reading,
Dax
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: Better Spellcheck Macro or a Other Solution

Post by kdock »

Well, first, trap the error and re-protect the file. That way, the macro will end gracefully and you've at least eliminated the issue of overwriting a form.

Search for vba error trapping and you should get a lot of hits.

Whether it's the spellchecker or the code is hard to tell since the problem is inconsistent. I'd have to know a little more about your code.* But I've not seen the spellchecker error out when run outside of code. Perhaps someone else has?

Best, Kim

*Edit: I reread your message and see it's from the mvp site. Have you made any changes to it or is it just as originally written? Have you been able to walk through the code and see the message (I realize this is tough when the problem is sporadic).
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

User avatar
HansV
Administrator
Posts: 78494
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Better Spellcheck Macro or a Other Solution

Post by HansV »

I tested your scenario in a small document protected for forms. I didn't get an error message despite repeated attempts, but I did notice an incorrect result:
S0376.png
Note that the text of the second form field with the preceding text has been placed in the third form field.
So the code doesn't keep track of the changes correctly. It appears to loop through the form fields multiple times...
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78494
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Better Spellcheck Macro or a Other Solution

Post by HansV »

Further to my previous reply: the authors cover this in their note #4; apparently it's a known problem. They have some suggestions for workarounds in the note.
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Better Spellcheck Macro or a Other Solution

Post by arroway »

Thanks Kdoc, I'll look for ways of how to write code and where to put it to trap the error and relock the form so the users don't keep writting over the form.

Hans,
Yes I saw that too but didn't think it applied as the form is not spellchecking the text in the document (maybe it is but there's no mispelled words there) and it isn't an issue of users being able to re-write protected text through a "back door". It's more the error issue. I'll try encapulating the form fields in tables as recommended by the post (all 78 of them, yikes!) and see if that does the trick.

Is there any other spellcheck macro air-code you know of that I might try instead of this other one?
Last edited by arroway on 12 Feb 2015, 21:47, edited 1 time in total.
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78494
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Better Spellcheck Macro or a Other Solution

Post by HansV »

See if Spell check only form fields on a protected document works better for you (I suspect it won't, but it's worth a try).
Best wishes,
Hans