Sort a table in an unprotected section of a protected document

J

Jenny E

I would like to use the sort function in a table that is in an unprotected
section of a document protected for forms. When the document is protected,
however, the sort function on the tables menu is greyed out even when my
cursor is in the unprotected section. Is there any way around this? I am
using Word 2002 and Windows 2000.
 
D

Doug Robbins

Use the following code in a macro

ActiveDocument.Unprotect
If Selection.Information(wdWithInTable) = True Then
Dialogs(wdDialogTableSort).Show
End If
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jenny E

Forgive my lack of knowledge on this. I have created the macro, but now am
unable to protect the document. What am I doing wrong?
--
Thanks so much for your reply. Am very grateful for the help!
Jenny


Doug Robbins said:
Use the following code in a macro

ActiveDocument.Unprotect
If Selection.Information(wdWithInTable) = True Then
Dialogs(wdDialogTableSort).Show
End If
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins

The document will need to be protected when the macro is run. To be able to
run a macro in a protected document, the macro will need to either be called
On exit from a formfield, be assigned to the keyboard or assigned to a
toolbar button.

See section 3 of the article at
http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Jenny E said:
Forgive my lack of knowledge on this. I have created the macro, but now
am
unable to protect the document. What am I doing wrong?
 
J

Jenny E

Doug - This is fantastic. The document doesn't lend itself to the macro
being assigned to the keyboard or run upon exit from a field, but assigning a
toolbar button is perfect. Works like a charm.

Thanks again for your help. So glad to have found this resource!
Jenny
 

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