macro for unprotecting form, update TOC, then reprotect form??

  • Thread starter Thread starter linda
  • Start date Start date
L

linda

It is a known issue that TOC page numbers do not update properly in a
protected form. What I am looking for is some sample macro that would
unprotect the form, force the TOC page numbers to update, then reprotect
the form. I would like this to be as seamless as possible to users of the
form.

I am not very knowledgeable in creating macros yet, and would appreciate any
help!!
 
Hi Linda,
It is a known issue that TOC page numbers do not update properly in a
protected form. What I am looking for is some sample macro that would
unprotect the form, force the TOC page numbers to update, then reprotect
the form. I would like this to be as seamless as possible to users of the
form.
Try this. I didn't test it, so no guarantees (like, I don't know whether the
TOC will finish updating before the protection is reinstated), but give it a
try:

Sub ShowEditLinks()
Dim doc As Word.Document

Set doc = ActiveDocument
If doc.ProtectionType <> wdNoProtection Then
doc.Unprotect
End If
doc.TablesOfContents(1).Update
doc.Protect wdAllowOnlyFormFields, True
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 

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

Back
Top