Running a macro on a protected document.

K

Kara

I have created a macro that will add lines to a table with the appropriate
form fields in each cell. However, I don't want people changing any other
part of the document except for being able to edit the form fields and add
additional lines to the table.

Can I run a macro on a protected document?

If not, the only other option is to add a table with a style and then allow
editing of that style. Will that work also?

Thank you!
 
J

Jay Freedman

Kara said:
I have created a macro that will add lines to a table with the
appropriate form fields in each cell. However, I don't want people
changing any other part of the document except for being able to edit
the form fields and add additional lines to the table.

Can I run a macro on a protected document?

If not, the only other option is to add a table with a style and then
allow editing of that style. Will that work also?

Thank you!

Hi Kara,

There are two parts to this... getting the macro started, and allowing the
macro to make changes in the form.

For the first part, provide a toolbar button to launch the macro, as part of
your template. See
http://word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm for
instructions. Although it's possible to use a MacroButton field or a command
button instead, it's more trouble than it's worth to try to keep it from
printing.

For the second part, your macro needs to unprotect the document, insert the
new table row, and reprotect the document. See
http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm for example
code.

Your second proposal won't work, because a style contains only formatting,
not table rows or fields.
 

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