How can I merge a data from excel into WORD 2003 when the document is protected?

B

benno

Hi,

This is my first post.

I am creating a form for a friend. The upper portion of the form is
merge data imported from excel. The problem is I can can not import th
data unless the document is unprotected. If I were to unprotect th
document then there is a chance my friend will revise the form which
do not want to happen.

How can I merge a data from excel into WORD 2003 when the document i
protected? Please help.

Thanks,
Berni
 
D

Doug Robbins

Try using the following macro

Sub MailMergeToDoc()
'
' MailMergeToDoc Macro
' Collects the results of the mail merge in a document
'
Dim mmmdoc As Document
Set mmmdoc = ActiveDocument
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
WordBasic.MailMergeToDoc
ActiveDocument.Protect wdAllowOnlyFormFields
mmmdoc.Protect wdAllowOnlyFormFields
End If

End Sub


--
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
 

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