N
NZ VBA Developer
This seems to be a popular topic lately, so I thought I'd chime in as well.
While the article at
http://word.mvps.org/faqs/macrosvba/SpellcheckProtectDoc.htm is great if you
want to check the spelling of the information input into formfields, my
problem is a bit different. I have (Word 2003) templates that produce
forms-protected documents, but the documents themselves don't contain any
formfields. I use forms protection only because it allows me to protect only
certain sections of the document, such as the header and footer, while
leaving other sections, such as the main body of the document unprotected.
The spellchecker checks the spelling in the unprotected sections OK, and I
don't really mind if it doesn't check the spelling in the protected sections
because 1) I know that I haven't made any spelling errors in the
'boilerplate' in these sections; and 2) if the user has made a spelling error
in the 'variable' information, they can just rerun the code in template to
correct the errors. However, there is a deficiency in the native spellchecker
that I've been asked to develop a workaround for.
In an unprotected document, if none of the choices in the 'Suggestions' list
are viable, you can just type in the 'Not in Dictionary' box to make the
change. However, this doesn't work in a protected document; the text in the
'Not in Dictionary' box is treated like it's in a protected section. I could
always write code that unprotects the document before displaying the
spellchecker, but there are a couple of drawbacks:
First, this will allow the users to spellcheck the protected sections as
well, which is not really a major problem except that if the user corrects an
error that was introduced through the input of the 'variable' information
described above, this correction won't get replicated back into the data from
the UserForm. Thus if the user reruns the template, the correction won't be
there and the error could be reintroduced without the user realising it.
However, I can live with this.
The real problem is that the spellchecker dialog isn't modal to Word.
Therefore, if I unprotect the document, the user now has full access to the
whole document, _including_ the protected sections. And believe me, the users
will take advantage of this whenever possible; I learned this when I told the
users I was going to fix a bug in my code that left the document unprotected
and got a... umm... less than favourable response. ;-D
Does anyone know a way to enable the editing capability in the 'Not in
Dictionary' box without unprotecting the document? Or will my users just have
to live with this limitation? (The second choice is acceptable as I'm quite
happy to tell the users 'No' - as long as I can justify the response.)
--
Cheers!
The Kiwi Koder
Please note: Uninvited email contact will be marked as SPAM and ignored -
unless you want to hire me.
While the article at
http://word.mvps.org/faqs/macrosvba/SpellcheckProtectDoc.htm is great if you
want to check the spelling of the information input into formfields, my
problem is a bit different. I have (Word 2003) templates that produce
forms-protected documents, but the documents themselves don't contain any
formfields. I use forms protection only because it allows me to protect only
certain sections of the document, such as the header and footer, while
leaving other sections, such as the main body of the document unprotected.
The spellchecker checks the spelling in the unprotected sections OK, and I
don't really mind if it doesn't check the spelling in the protected sections
because 1) I know that I haven't made any spelling errors in the
'boilerplate' in these sections; and 2) if the user has made a spelling error
in the 'variable' information, they can just rerun the code in template to
correct the errors. However, there is a deficiency in the native spellchecker
that I've been asked to develop a workaround for.
In an unprotected document, if none of the choices in the 'Suggestions' list
are viable, you can just type in the 'Not in Dictionary' box to make the
change. However, this doesn't work in a protected document; the text in the
'Not in Dictionary' box is treated like it's in a protected section. I could
always write code that unprotects the document before displaying the
spellchecker, but there are a couple of drawbacks:
First, this will allow the users to spellcheck the protected sections as
well, which is not really a major problem except that if the user corrects an
error that was introduced through the input of the 'variable' information
described above, this correction won't get replicated back into the data from
the UserForm. Thus if the user reruns the template, the correction won't be
there and the error could be reintroduced without the user realising it.
However, I can live with this.
The real problem is that the spellchecker dialog isn't modal to Word.
Therefore, if I unprotect the document, the user now has full access to the
whole document, _including_ the protected sections. And believe me, the users
will take advantage of this whenever possible; I learned this when I told the
users I was going to fix a bug in my code that left the document unprotected
and got a... umm... less than favourable response. ;-D
Does anyone know a way to enable the editing capability in the 'Not in
Dictionary' box without unprotecting the document? Or will my users just have
to live with this limitation? (The second choice is acceptable as I'm quite
happy to tell the users 'No' - as long as I can justify the response.)
--
Cheers!
The Kiwi Koder
Please note: Uninvited email contact will be marked as SPAM and ignored -
unless you want to hire me.