Hi-

I have a Word97 template with 3 bookmarks. After I run a macro which does a
MailMerge, the resulting document does not have the bookmarks.

Why? All other text from the template is in the new document.

How can the bookmarks also be "carried forth" into the created document?

(I created the bookmarks by positioning the cursor where I wanted, and going
to the Insert Tab, and then selecting Bookmark. I entered the bookmark name,
and hit the Add button.)

Thanks,

Marty

Re: Bookmarks in a template by Helmut

Helmut
Wed Feb 02 16:49:19 CST 2005

Hi Marty,

no way! A bookmark is a unique location.
So, it is not possible to have the same bookmark
more than once in a document.
Workarounds? Probably.
Possibly pretty complicated.
If you could tell us, what exactly you want to do.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/



Re: Bookmarks in a template by Marty

Marty
Thu Feb 03 07:51:01 CST 2005

Hi Helmut-

I am generating a document using a Word97 template (.dot). As the user
checks off checkboxes and optionboxes, I will know if parts of the template
should be eliminated.

So, I thought that if I put in some bookmarks into the template, I could
then add to the macro a section that would delete the text between the
certain bookmarks if it is not required.

But the bookmarks do not appear in the merged document.

For example: If I have a 4 pages of text in the middle of the template
referring to stamp collecting, but the user checks the box that says he is
not a stamp collector, then I do not want to show those 4 pages after the
mailmerge.

I thought that by putting a bookmark (BK1) before these 4 pages, and another
bookmark (BK2) after, that I could then delete all text between these 2
bookmarks just after the code that does the mailmerge. But the bookmarks do
not appear in the merged document.

So, how may I delete the 4 pages? (I have several of these sections which
may or may not be deleted, depending on the answers to the check boxes.)

Thanks,

Marty

"Helmut Weber" wrote:

> Hi Marty,
>
> no way! A bookmark is a unique location.
> So, it is not possible to have the same bookmark
> more than once in a document.
> Workarounds? Probably.
> Possibly pretty complicated.
> If you could tell us, what exactly you want to do.
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/
>
>
>

Re: Bookmarks in a template by Charles

Charles
Thu Feb 03 09:33:55 CST 2005

If you use mailmerge to a new result document, all bookmarks (and fields)
are lost. See if you can generate your result without a final mailmerge. I
use mailmerge with single records and use the merge preview screen. This
still has fields and bookmarks.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Marty" <Marty@discussions.microsoft.com> wrote in message
news:C6DDBC37-E178-4911-A557-C6D6E5002F81@microsoft.com...
> Hi Helmut-
>
> I am generating a document using a Word97 template (.dot). As the user
> checks off checkboxes and optionboxes, I will know if parts of the
> template
> should be eliminated.
>
> So, I thought that if I put in some bookmarks into the template, I could
> then add to the macro a section that would delete the text between the
> certain bookmarks if it is not required.
>
> But the bookmarks do not appear in the merged document.
>
> For example: If I have a 4 pages of text in the middle of the template
> referring to stamp collecting, but the user checks the box that says he is
> not a stamp collector, then I do not want to show those 4 pages after the
> mailmerge.
>
> I thought that by putting a bookmark (BK1) before these 4 pages, and
> another
> bookmark (BK2) after, that I could then delete all text between these 2
> bookmarks just after the code that does the mailmerge. But the bookmarks
> do
> not appear in the merged document.
>
> So, how may I delete the 4 pages? (I have several of these sections which
> may or may not be deleted, depending on the answers to the check boxes.)
>
> Thanks,
>
> Marty
>
> "Helmut Weber" wrote:
>
>> Hi Marty,
>>
>> no way! A bookmark is a unique location.
>> So, it is not possible to have the same bookmark
>> more than once in a document.
>> Workarounds? Probably.
>> Possibly pretty complicated.
>> If you could tell us, what exactly you want to do.
>>
>> Greetings from Bavaria, Germany
>>
>> Helmut Weber, MVP
>> "red.sys" & chr(64) & "t-online.de"
>> Word XP, Win 98
>> http://word.mvps.org/
>>
>>
>>



Re: Bookmarks in a template by Helmut

Helmut
Fri Feb 04 15:06:06 CST 2005

Hi Marty,

sometimes the most simple way is the best.
Instead of using bookmarks, it may be possible
to use unique strings like #0# and #1# instead
of bookmarks. Delete them and all in between in
case 1 or just the strings themselves in case 2.

If that would destroy your formatting, it may be
possible to use colors, or some otherwise
not used formatting.


Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/

Re: Bookmarks in a template by Marty

Marty
Tue Feb 08 09:59:02 CST 2005

Hi Helmut-

Yes, I see your point. So, I created a test macro:

Sub test()
Dim oRng As Range
'
'
With ActiveDocument
Set oRng = .Range _
(Start:=.Text("#000#").Range.End, _
End:=.text("#111#").Range.Start)
oRng.Delete
End With


End Sub


But it gives me a Run-time error 438 (Object doesn't support this property
or method.)

Is there other coding that can be used? (Remember, I'm running Word97.)

Thanks for all your time and help.

-Marty


"Helmut Weber" wrote:

> Hi Marty,
>
> sometimes the most simple way is the best.
> Instead of using bookmarks, it may be possible
> to use unique strings like #0# and #1# instead
> of bookmarks. Delete them and all in between in
> case 1 or just the strings themselves in case 2.
>
> If that would destroy your formatting, it may be
> possible to use colors, or some otherwise
> not used formatting.
>
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/
>

Re: Bookmarks in a template by Helmut

Helmut
Tue Feb 15 06:55:10 CST 2005

Hi Marty,

somehow this thread got lost.


Sub Makro11()
Dim rDcm As Range
Dim rTmp As Range
Set rDcm = ActiveDocument.Range
Set rTmp = Selection.Range
ResetSearch
With rDcm.Find
.Text = "#001#"
If .Execute Then
rTmp.Start = rDcm.Start
rDcm.Collapse direction:=wdCollapseEnd
.Text = "#002#"
If .Execute Then
rTmp.End = rDcm.End
rTmp.Select
' or delete it
End If
End If
End With
ResetSearch
End Sub

Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
' plus some more
.Execute
End With
End Sub

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/