Hi all,

I've an Access db that writes to a Word document using bookmarks. I have
the template lined up just the way I want it; when the db writes info to the
template, the lines become offset by the difference in text length between
the bookmark and the data replacing the bookmark. For example, if
"McCracken" replaces "Last", the rest of the line is adjusted 5 places to the
right for the extra characters in "McCracken". If at all possible, I'd very
much like to have the system account for the extra spaces and delete them
during the process.

I was playing around with Word.Options.AutoFormatAsYouTypeInsertOvers and
Word.Options.Overwrite, but couldn't get them to work. Are one of these the
way to go? Or do I have to programmatically use the Len() function to
calcuate the difference in the text strings and then add/delete spaces? If
so, how exactly would that look?

I hope this made sense and thanks very much for your time and help.
Paul

Re: Bookmark with overwrite function? by Jay

Jay
Thu Jun 23 12:31:48 CDT 2005

pvdalen wrote:
> Hi all,
>
> I've an Access db that writes to a Word document using bookmarks. I
> have the template lined up just the way I want it; when the db writes
> info to the template, the lines become offset by the difference in
> text length between the bookmark and the data replacing the bookmark.
> For example, if "McCracken" replaces "Last", the rest of the line is
> adjusted 5 places to the right for the extra characters in
> "McCracken". If at all possible, I'd very much like to have the
> system account for the extra spaces and delete them during the
> process.
>
> I was playing around with Word.Options.AutoFormatAsYouTypeInsertOvers
> and Word.Options.Overwrite, but couldn't get them to work. Are one
> of these the way to go? Or do I have to programmatically use the
> Len() function to calcuate the difference in the text strings and
> then add/delete spaces? If so, how exactly would that look?
>
> I hope this made sense and thanks very much for your time and help.
> Paul

Hi Paul,

It's not so much that it does or doesn't make sense, as that you're trying
to solve the wrong problem.

I assume that the placeholder (what you're calling a bookmark, but that's
something different in Word's jargon) is followed on the same line by other
text, and you're trying to make sure the other text doesn't move when you
make the replacement. There are two 'proper' ways to do that, and neither of
them involves spaces.

(1) Set a tab stop at the proper position for the beginning of the other
text, and separate the placeholder from that text with a tab character. As
long as the replacement's length is shorter than the distance up to the tab
stop, the other text won't move.

(2) Create a two-column table, inserting the placeholder in the first cell
and the other text in the second cell. If you turn off the table's borders,
and set Table > AutoFit to "Fixed column width", the replacement won't
affect the position.

The trouble with positioning by spaces is that, unless you format the text
in a nonproportional font such as Courier New or Lucida Sans Typewriter, you
can't guarantee alignment of the following text. You certainly can't figure
out the physical width of text by counting its characters.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



Re: Bookmark with overwrite function? by pvdalen

pvdalen
Thu Jun 23 15:44:03 CDT 2005

Hey Jay,

Thanks very much for the response. This may sound stupid, because I'm
generally aware of issues regarding using spaces, but the only reason I was
attempting it this way was to have the remainder of the space between the
bookmark(s) and next column of text printed with an underline character.
I'll give your suggestion a shot.

Thanks very much!
Paul

"Jay Freedman" wrote:

> pvdalen wrote:
> > Hi all,
> >
> > I've an Access db that writes to a Word document using bookmarks. I
> > have the template lined up just the way I want it; when the db writes
> > info to the template, the lines become offset by the difference in
> > text length between the bookmark and the data replacing the bookmark.
> > For example, if "McCracken" replaces "Last", the rest of the line is
> > adjusted 5 places to the right for the extra characters in
> > "McCracken". If at all possible, I'd very much like to have the
> > system account for the extra spaces and delete them during the
> > process.
> >
> > I was playing around with Word.Options.AutoFormatAsYouTypeInsertOvers
> > and Word.Options.Overwrite, but couldn't get them to work. Are one
> > of these the way to go? Or do I have to programmatically use the
> > Len() function to calcuate the difference in the text strings and
> > then add/delete spaces? If so, how exactly would that look?
> >
> > I hope this made sense and thanks very much for your time and help.
> > Paul
>
> Hi Paul,
>
> It's not so much that it does or doesn't make sense, as that you're trying
> to solve the wrong problem.
>
> I assume that the placeholder (what you're calling a bookmark, but that's
> something different in Word's jargon) is followed on the same line by other
> text, and you're trying to make sure the other text doesn't move when you
> make the replacement. There are two 'proper' ways to do that, and neither of
> them involves spaces.
>
> (1) Set a tab stop at the proper position for the beginning of the other
> text, and separate the placeholder from that text with a tab character. As
> long as the replacement's length is shorter than the distance up to the tab
> stop, the other text won't move.
>
> (2) Create a two-column table, inserting the placeholder in the first cell
> and the other text in the second cell. If you turn off the table's borders,
> and set Table > AutoFit to "Fixed column width", the replacement won't
> affect the position.
>
> The trouble with positioning by spaces is that, unless you format the text
> in a nonproportional font such as Courier New or Lucida Sans Typewriter, you
> can't guarantee alignment of the following text. You certainly can't figure
> out the physical width of text by counting its characters.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
>
>

Re: Bookmark with overwrite function? by Jay

Jay
Thu Jun 23 19:16:35 CDT 2005

You can apply Underline formatting to the tab character to get that
effect.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

On Thu, 23 Jun 2005 13:44:03 -0700, "pvdalen"
<pvdalen@discussions.microsoft.com> wrote:

>Hey Jay,
>
>Thanks very much for the response. This may sound stupid, because I'm
>generally aware of issues regarding using spaces, but the only reason I was
>attempting it this way was to have the remainder of the space between the
>bookmark(s) and next column of text printed with an underline character.
>I'll give your suggestion a shot.
>
>Thanks very much!
>Paul
>
>"Jay Freedman" wrote:
>
>> pvdalen wrote:
>> > Hi all,
>> >
>> > I've an Access db that writes to a Word document using bookmarks. I
>> > have the template lined up just the way I want it; when the db writes
>> > info to the template, the lines become offset by the difference in
>> > text length between the bookmark and the data replacing the bookmark.
>> > For example, if "McCracken" replaces "Last", the rest of the line is
>> > adjusted 5 places to the right for the extra characters in
>> > "McCracken". If at all possible, I'd very much like to have the
>> > system account for the extra spaces and delete them during the
>> > process.
>> >
>> > I was playing around with Word.Options.AutoFormatAsYouTypeInsertOvers
>> > and Word.Options.Overwrite, but couldn't get them to work. Are one
>> > of these the way to go? Or do I have to programmatically use the
>> > Len() function to calcuate the difference in the text strings and
>> > then add/delete spaces? If so, how exactly would that look?
>> >
>> > I hope this made sense and thanks very much for your time and help.
>> > Paul
>>
>> Hi Paul,
>>
>> It's not so much that it does or doesn't make sense, as that you're trying
>> to solve the wrong problem.
>>
>> I assume that the placeholder (what you're calling a bookmark, but that's
>> something different in Word's jargon) is followed on the same line by other
>> text, and you're trying to make sure the other text doesn't move when you
>> make the replacement. There are two 'proper' ways to do that, and neither of
>> them involves spaces.
>>
>> (1) Set a tab stop at the proper position for the beginning of the other
>> text, and separate the placeholder from that text with a tab character. As
>> long as the replacement's length is shorter than the distance up to the tab
>> stop, the other text won't move.
>>
>> (2) Create a two-column table, inserting the placeholder in the first cell
>> and the other text in the second cell. If you turn off the table's borders,
>> and set Table > AutoFit to "Fixed column width", the replacement won't
>> affect the position.
>>
>> The trouble with positioning by spaces is that, unless you format the text
>> in a nonproportional font such as Courier New or Lucida Sans Typewriter, you
>> can't guarantee alignment of the following text. You certainly can't figure
>> out the physical width of text by counting its characters.
>>
>> --
>> Regards,
>> Jay Freedman
>> Microsoft Word MVP FAQ: http://word.mvps.org
>>
>>
>>


Re: Bookmark with overwrite function? by Rodi

Rodi
Fri Jun 24 11:15:03 CDT 2005

Yep, that's exactly what I found when I took you're earlier suggestion to use
that tab stop and everything worked like a charm!

Thanks again for all your help, Jay.


"Jay Freedman" wrote:

> You can apply Underline formatting to the tab character to get that
> effect.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
> On Thu, 23 Jun 2005 13:44:03 -0700, "pvdalen"
> <pvdalen@discussions.microsoft.com> wrote:
>
> >Hey Jay,
> >
> >Thanks very much for the response. This may sound stupid, because I'm
> >generally aware of issues regarding using spaces, but the only reason I was
> >attempting it this way was to have the remainder of the space between the
> >bookmark(s) and next column of text printed with an underline character.
> >I'll give your suggestion a shot.
> >
> >Thanks very much!
> >Paul
> >
> >"Jay Freedman" wrote:
> >
> >> pvdalen wrote:
> >> > Hi all,
> >> >
> >> > I've an Access db that writes to a Word document using bookmarks. I
> >> > have the template lined up just the way I want it; when the db writes
> >> > info to the template, the lines become offset by the difference in
> >> > text length between the bookmark and the data replacing the bookmark.
> >> > For example, if "McCracken" replaces "Last", the rest of the line is
> >> > adjusted 5 places to the right for the extra characters in
> >> > "McCracken". If at all possible, I'd very much like to have the
> >> > system account for the extra spaces and delete them during the
> >> > process.
> >> >
> >> > I was playing around with Word.Options.AutoFormatAsYouTypeInsertOvers
> >> > and Word.Options.Overwrite, but couldn't get them to work. Are one
> >> > of these the way to go? Or do I have to programmatically use the
> >> > Len() function to calcuate the difference in the text strings and
> >> > then add/delete spaces? If so, how exactly would that look?
> >> >
> >> > I hope this made sense and thanks very much for your time and help.
> >> > Paul
> >>
> >> Hi Paul,
> >>
> >> It's not so much that it does or doesn't make sense, as that you're trying
> >> to solve the wrong problem.
> >>
> >> I assume that the placeholder (what you're calling a bookmark, but that's
> >> something different in Word's jargon) is followed on the same line by other
> >> text, and you're trying to make sure the other text doesn't move when you
> >> make the replacement. There are two 'proper' ways to do that, and neither of
> >> them involves spaces.
> >>
> >> (1) Set a tab stop at the proper position for the beginning of the other
> >> text, and separate the placeholder from that text with a tab character. As
> >> long as the replacement's length is shorter than the distance up to the tab
> >> stop, the other text won't move.
> >>
> >> (2) Create a two-column table, inserting the placeholder in the first cell
> >> and the other text in the second cell. If you turn off the table's borders,
> >> and set Table > AutoFit to "Fixed column width", the replacement won't
> >> affect the position.
> >>
> >> The trouble with positioning by spaces is that, unless you format the text
> >> in a nonproportional font such as Courier New or Lucida Sans Typewriter, you
> >> can't guarantee alignment of the following text. You certainly can't figure
> >> out the physical width of text by counting its characters.
> >>
> >> --
> >> Regards,
> >> Jay Freedman
> >> Microsoft Word MVP FAQ: http://word.mvps.org
> >>
> >>
> >>
>
>