View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Smhall Smhall is offline
external usenet poster
 
Posts: 9
Default Protect form fields in merged files

Thanks for sending me in the right direction. I got it to work by putting 2
new commands in the "SplitMergeLetter" macro I copied from Graham Mayor's web
site. The first command unprotects the new document and the second command
re-protects it. I'm copying it here in case anyone in the future (who feels
WAY in over their heads) needs it:

Sub Splitter()
ActiveDocument.Unprotect
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter Letters
Application.ScreenUpdating = False
With Selection
..HomeKey Unit:=wdStory
..EndKey Unit:=wdLine, Extend:=wdExtend
..MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With
sName = Selection
Docname = "c:\in process\merge\" & sName & ".doc"
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With Selection
..Paste
..HomeKey Unit:=wdStory
..MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
..Delete
End With
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset
ActiveDocument.SaveAs FileName:=Docname, _
FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend

End Sub

FYI: You need to change the Doc Name to a valid path and make sure the file
name is the VERY FIRST thing in the document

"Doug Robbins - Word MVP" wrote:

After you create each individual document, use the command to protect it.

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

"Smhall" wrote in message
...
Using the information from the amazing MVPs, I have created a document
that
merges excel data into a document with form fields(that spell checks!!!).
I'm stuck on one last piece of the puzzle. I am trying to split the
merged
document into individual files using a merge field as the user name. If
the
merged document has the form proctection turned off, it works, but then
all
the new documents are unprocted as well. Is there a way to keep the form
protection in my new documents?