Pasting into a protected word doc

P

Phil H

I have a word doc that I have sectioned into a table. Some of the cells have
"Text Form Fields" that are protected allowing only form fields to be written
to. I want to be able to have the users paste a Visio drawing into one of the
cells via "Cut N Paste". Once protected it locks me out of that cell. I want
a macro to unprotect the doc (or cell) allow the "Cut N Paste" then
reprotect. Is this possible?

I am using Word 2003
 
J

Jonathan West

Phil H said:
I have a word doc that I have sectioned into a table. Some of the cells
have
"Text Form Fields" that are protected allowing only form fields to be
written
to. I want to be able to have the users paste a Visio drawing into one of
the
cells via "Cut N Paste". Once protected it locks me out of that cell. I
want
a macro to unprotect the doc (or cell) allow the "Cut N Paste" then
reprotect. Is this possible?

I am using Word 2003

Yes. The following article shows how to unprotect and then reprotect for the
purpose of spell-checking. The same principle can be applied to any action
you can only take on an unprotected document

How to enable the spellchecker in a protected document
http://www.word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm
 
P

Phil H

First I want to thank you for responding. I understand how to
unprotect/reprotect the doc in a macro. What I don't understand is how to get
the macro to allow a user total control of that cell (cut & paste, resize,
delete, etc), then reprotect.
 
G

Gordon Bentley-Mix

Phil,

The short answer is, you can't - at least not without doing a lot of work to
try to replicate what Word does natively, and even then I doubt you would be
satisfied with the result.

There is no way to unprotect just a single cell in a table. You might be
able to "fake it" by placing the cell you want to work with in a row by
itself and then putting continuous section breaks before and after the row.
Then you could just make that section unprotected. This wouldn't require any
programming, as it's something that Word supports out of the box.

The problem with a programmatic approach is that it would be very difficult
to specify exactly which cell you want to manipulate and then restrict
functionality to that cell only. You can't just write some (simple) code to
unprotect the document, insert an image, and then reprotect it again. This is
because you can't put the cursor into the cell (as you well know), so it's
nearly impossible to specify the "insertion point" for the image.

I've face a similar problem with trying to provide functionality for users
to manipulate the images in a protected document. When a document is
protected, the users cannot even select an image, so trying to do things like
position the image on the page or resize it (or even delete it) is
impossible. My less-than-adequate solution is to display a userform with a
list of the images for the user to select from and then invoke the native
Word 'Format Picture' dialog. Of course this doesn't work very well because:
1) Word tells you bugger-all about pictures so it's hard to tell which image
to select; and 2) it's a lot harder to position an image using the 'Format
Picture' dialog than it is using the arrow keys; usually multiple attempts
are required.

The only possible solution I can think of to your particular problem is to
do something similar with a table: display a "list" of the cells in the table
and have the user select the cell they want to put the image in. Even worse
than my image formatting solution above, IMHO.

You might be able to do something like insert a formfield into the cell (so
the users can at least put the cursor into the cell) and then replace the
formfield with the image, but even this has its limitations. You would
struggle to limit the functionality only to a particular cell or cells; the
functionality would work in any cell with a formfield in it. You also
wouldn't be able to work with the image or the cell after it was inserted, as
the cell would then be locked again.

So in short, what you're asking for cannot be done - at least not easily and
not in a way that would be acceptable to most users. My solution to this
would be to "fake it" as I described above.
--
Cheers!
Gordon
The Kiwi Koder

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 
P

Phil H

Gordon,

I thank you for giving me some insite into the inner workings (limitations)
of Word. The solution was simple. You hit it with your second paragraph. The
cell was the last on the page and it was the width of the page. I inserted a
"Continuous Section Break" and was able to protect the upper section
enabling the lower section of the page for pasting. It now works as I
envisioned.

Thank you all for all of your help,

Phil H
 

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