Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2006

Tip: Looking for answers? Try searching our database.

Protect form fields in merged files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Smhall - 09 Aug 2006 20:22 GMT
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?
Doug Robbins - Word MVP - 09 Aug 2006 21:49 GMT
After you create each individual document, use the command to protect it.

ActiveDocument.Protect wdAllowOnlyFormFields, NoReset

Signature

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

> Using the information from the amazing MVPs, I have created a document
> that
[quoted text clipped - 7 lines]
> the new documents are unprocted as well.  Is there a way to keep the form
> protection in my new documents?
Smhall - 09 Aug 2006 22:55 GMT
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

> After you create each individual document, use the command to protect it.
>
[quoted text clipped - 11 lines]
> > the new documents are unprocted as well.  Is there a way to keep the form
> > protection in my new documents?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.