Reply
 
Thread Tools Display Modes
  #1   Report Post  
beabvo
 
Posts: n/a
Default Keep form fields after protected mailmerge

Hi,

I´m making several mailmerge templates in Word2000.
Some of these templates are being protected after mailmerging with a custom
made application.

In some of these documents I also use form fields so my users can add
information.
But, after the mailmerge, the form fields are also being protected, which is
not acceptable for my users (and me).

Can someone help me fix my problem. I´m trying to keep the documents as
simple as possible, so the support can be kept simple as well.

tx
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

These two features of Word are not compatible. For someone who needed to do
the same thing, I created the following macro that will "preserve" =
re-create the bookmarks in mailmerge. Once the locations of the formfields
are identified by the bookmarks, it's just a simple bit of code to add back
the formfields.

' Throwaway Macro created by Doug Robbins to "preserve" bookmarks during a
MailMerge

'

Dim abm As Bookmark, bmrange As Range, i As Long, Result As Document, j As
Long, k As Long, linkrange As Range, linktarget As String

Dim Source As Document

Set Source = ActiveDocument

i = 1

For j = 1 To Source.MailMerge.DataSource.RecordCount

For Each abm In ActiveDocument.Range.Bookmarks

System.PrivateProfileString("c:\bookmarks.txt", "bookmarkNames",
"bookmark" & i) = abm.Name & Format(j)

i = i + 1

Next

Next j

For Each abm In ActiveDocument.Range.Bookmarks

abm.Range.InsertBefore "#"

abm.Range.InsertAfter "#"

Next

With ActiveDocument.MailMerge

.Destination = wdSendToNewDocument

.Execute

End With

Set Result = ActiveDocument

k = 1

Selection.HomeKey wdStory

Selection.Find.ClearFormatting

With Selection.Find

Do While .Execute(FindText:="#*#", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True

Set bmrange = Selection.Range

bmrange.Characters(bmrange.Characters.Count).Delet e

bmrange.Characters(1).Delete

Result.Bookmarks.Add System.PrivateProfileString("c:\bookmarks.txt",
"bookmarkNames", "bookmark" & k), bmrange

k = k + 1

Loop

End With

For i = 1 To Result.Hyperlinks.Count

linktarget = Result.Hyperlinks(i).SubAddress

Set linkrange = Result.Hyperlinks(i).Range

linkrange.Select

linktarget = linktarget &
Format(Selection.Information(wdActiveEndSectionNum ber))

Result.Hyperlinks.Add Result.Hyperlinks(i).Range, "", linktarget

Next i



Source.Activate

Selection.HomeKey wdStory

Selection.Find.ClearFormatting

With Selection.Find

Do While .Execute(FindText:="#*#", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True

Set bmrange = Selection.Range

bmrange.Characters(bmrange.Characters.Count).Delet e

bmrange.Characters(1).Delete

Loop

End With

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"beabvo" wrote in message
...
Hi,

I´m making several mailmerge templates in Word2000.
Some of these templates are being protected after mailmerging with a
custom
made application.

In some of these documents I also use form fields so my users can add
information.
But, after the mailmerge, the form fields are also being protected, which
is
not acceptable for my users (and me).

Can someone help me fix my problem. I´m trying to keep the documents as
simple as possible, so the support can be kept simple as well.

tx



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Protected Fields in an Online Form hnyb1 Microsoft Word Help 5 January 19th 05 02:52 PM
Word document with fill-in fields protected as a form homeofbonnie Microsoft Word Help 0 January 18th 05 05:13 PM
Email a protected document that contains Text Form Fields Dowza New Users 1 January 8th 05 10:31 AM
Document object in protected form Bruce Tables 2 December 6th 04 07:09 PM
Text boxes in protected Doc, form fields BP522 Microsoft Word Help 5 December 3rd 04 07:55 PM


All times are GMT +1. The time now is 05:01 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"