URGENT-SUDDENLY bookmarks lost when doing MailMerge to New Documen

T

ThomasAJ

No new updates, no changes recently, and all of a sudden bookmarks are not
there when mailmerged to a new document.

They are there in the source doc but NOT the new doc.

I have re-installed (the repair option) Office 2003.
 
T

ThomasAJ

New info. Created a new document with 1 bookmark. It conatins a Mergefield
from a DB. The bookmark is used thus: { =Bookmark }. I merge this doc to a
new doc. The new doc is created and initially shows the value of the merge
field. I press the PRINT icon, it prints my selected (say 7 pages), each one
has !Undefined Bookmark.

As I said previously I re-installed office 2003, it has SP2.

HELP please! This office cannot send any documents out.
 
T

ThomasAJ

Merge to Printer and to Email are fine.

Problem is only merge to new doc and then when I hit the print button it
loses the bookmarks.
 
D

Doug Robbins - Word MVP

The reason that the bookmarks are lost is because each bookmark in a
document must define a unique location in the document. If you execute the
merge to a new document, there would, in your case, be 7 locations, each
trying to use the one bookmark, which of course cannot be the case, so the
bookmarks do not appear in the document.

The following macro can be used as a work around

' 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).Delete

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(wdActiveEndSectionNumber))

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).Delete

bmrange.Characters(1).Delete

Loop

End With


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

ThomasAJ

Hi Doug

I have been using these bookmarks for 18 months and all has worked just fine.

I repeat that this problem ONLY occurs when I merge to a new doc and ONLY
when I hit the PRINT key. So it views just fine but becomes !Undefined as
soon as I hit the print key.

It merges to email and direct to printer 100% fine.

Regarding the 7 docs, this problem also occurs if I select ONLY 1 record.

This problem occurred suddenly yesterday afternoon so I 'repaired' Office
but no luck.

Maybe I should totally re-install!
 
D

Doug Robbins - Word MVP

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

ThomasAJ said:
Hi Doug

I have been using these bookmarks for 18 months and all has worked just
fine.

I repeat that this problem ONLY occurs when I merge to a new doc and ONLY
when I hit the PRINT key. So it views just fine but becomes !Undefined as
soon as I hit the print key.

It merges to email and direct to printer 100% fine.

Regarding the 7 docs, this problem also occurs if I select ONLY 1 record.

This problem occurred suddenly yesterday afternoon so I 'repaired' Office
but no luck.

Maybe I should totally re-install!
 
D

Doug Robbins - Word MVP

From the Tools menu, select Options and then go to the Print tab and uncheck
the Update Fields item.

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

ThomasAJ said:
Hi Doug

I have been using these bookmarks for 18 months and all has worked just
fine.

I repeat that this problem ONLY occurs when I merge to a new doc and ONLY
when I hit the PRINT key. So it views just fine but becomes !Undefined as
soon as I hit the print key.

It merges to email and direct to printer 100% fine.

Regarding the 7 docs, this problem also occurs if I select ONLY 1 record.

This problem occurred suddenly yesterday afternoon so I 'repaired' Office
but no luck.

Maybe I should totally re-install!
 
T

ThomasAJ

YES it did!
Of course I thank you very much.
Can you shed some light as to your reasoning please. This has been working
fine for some 18 months. Has an Office update casued this? There was an auto
update on Sunday but this started to fail 3 days after.

Also I don't know the down side to this change.
I use bookmarks extensively as results of calculations based on MergeFields.
(Yes I know it's best to use the database BEFORE feeding Word and I do but
sometimes it's easier in Word under certain circumstances)
 
D

Doug Robbins - Word MVP

No, I don't know what would have changed. However, Updating of Fields
before printing is something that you would normally want to happen,
particularly for a document that contains a Table of Contents to ensure that
the page numbers in the table match those in the document. Also if you have
Page X of Y Pages to ensure that Y is the total number of pages in the
document.

On the other hand, the use of bookmarks is a mailmerge main document is to
be discouraged for the reason that I originally posted.

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

ThomasAJ

Hi Doug

How do I contact you for Word consulting. Sorry but cannot find your contact
details anywhere.

I want to get this stuff I have done rock solid - it's important to my
company.

The consulting would not properly start until about Feb 2007 as here in OZ
the peak summer season is coming up for us and I am not doing any more
meaningful changes.

However there may be some minor stuff.

Tom
 
D

Doug Robbins - Word MVP

Here is my email address, well sort of, that should appear if you respond to
one of my posts

(e-mail address removed)

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