Spell check for password protected forms

C

Claudine

As password protection is essential for my form, can someone please tell me
exactly where I insert Graham Mayor's extra code quoted at the end of this
post?

Thanks to Graham's sample code, I have got the spell check macro working but
only without the password. Please assume I know nothing about visual basic -
I have not used it before and only made macros previously via recording, thus
avoiding inexplicable codes.

Many thanks for your advice. The users of my form will greatly appreciate
spell checking. Graham's extra code (but no advice on placement) is as
follows:

oDoc.Unprotect Password:="Password"


And:

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="Password"
 
J

Jay Freedman

As password protection is essential for my form, can someone please tell me
exactly where I insert Graham Mayor's extra code quoted at the end of this
post?

Thanks to Graham's sample code, I have got the spell check macro working but
only without the password. Please assume I know nothing about visual basic -
I have not used it before and only made macros previously via recording, thus
avoiding inexplicable codes.

Many thanks for your advice. The users of my form will greatly appreciate
spell checking. Graham's extra code (but no advice on placement) is as
follows:

oDoc.Unprotect Password:="Password"


And:

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="Password"

I assume that somewhere in your macro, probably near the beginning, there is a
statement

oDoc.Unprotect

If you're using the macro from the article
http://www.word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm, that statement
is just after the comments

'If we've got this far, it's protected for forms
'Now unprotect the document

You need to change that line to

oDoc.Unprotect Password:="Password"

Similarly, somewhere near the end of the macro will be a statement

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

In the article's macro, that's just after the comment

'Re-protect the document

You must replace that with the two lines

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="Password"

Of course, replace the word in quotes with the actual password for the form.
 
C

Claudine

Thanks Jay for your clear excellent instructions - it worked perfectly! A
miracle after the head ache this literally caused me.

I'll be uploading my new and improved spell checkable form soon for State
Heritage Register nominations at www.heritage.nsw.gov.au/listings if others
want to see this (hopefully) in action.

Kind regards,
Claudine
 
B

Blair

Jay Freedman said:
I assume that somewhere in your macro, probably near the beginning, there is a
statement

oDoc.Unprotect

If you're using the macro from the article
http://www.word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm, that statement
is just after the comments

'If we've got this far, it's protected for forms
'Now unprotect the document

You need to change that line to

oDoc.Unprotect Password:="Password"

Similarly, somewhere near the end of the macro will be a statement

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

In the article's macro, that's just after the comment

'Re-protect the document

You must replace that with the two lines

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="Password"

Of course, replace the word in quotes with the actual password for the form.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
B

Blair

Jay Freedman said:
I assume that somewhere in your macro, probably near the beginning, there is a
statement

oDoc.Unprotect

If you're using the macro from the article
http://www.word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm, that statement
is just after the comments

'If we've got this far, it's protected for forms
'Now unprotect the document

You need to change that line to

oDoc.Unprotect Password:="Password"

Similarly, somewhere near the end of the macro will be a statement

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

In the article's macro, that's just after the comment

'Re-protect the document

You must replace that with the two lines

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="Password"

Of course, replace the word in quotes with the actual password for the form.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.



********************************************
In following the directions above,
I receive a "Syntex error" after adding the
oDoc.Unprotect Password:="Password"

Can you help me?
 
G

Graham Mayor

This thread seems to have become so disjointed that I haven't a clue where
you are up to. The code to spell check forms is as follows. Put your
password for the form in place of 'password' where indicated. For forms
without a password change that line to
sPassword = ""
http://www.gmayor.com/installing_macro.htm shows how to use the code. Run it
from a toolbar button.


Sub SpellCheckForm()
Dim i As Integer
Dim bProtected As Boolean
Dim sPassword As String

'***************************
'Password to unprotect
sPassword = "password"

'***************************
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=sPassword
End If
'check each formfield for spelling
For i = 1 To ActiveDocument.FormFields.Count
ActiveDocument.FormFields(i).Select
#If VBA6 Then
Selection.NoProofing = False
#End If
Selection.LanguageID = wdEnglishUS
Selection.Range.CheckSpelling
Next
'Reprotect the document.
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, _
Password:=sPassword
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top