J
J Pettigrew
Hello,
I have a situation where I add a text box in code and
position it on the page.
This code works perfectly as it stands:
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal,
88#, _
637.35, 445.35, 35.3).Select
BUT
It places the anchor on the last paragraph mark on the
page. I do not want this (even if I tell it not to move the
anchor with the text, it still takes the textbox to page 2
when that paragraph mark is moved to a second page in the
document). It must be attached to a bookmark higher up on
the page.
According to the online help, there is an optional variant
I can add in the arguments to position or attach the anchor
to a range object.
This is quoted from the VBA help (and is reiterated in the
KBase) "Anchor - Optional Variant. A Range object that
represents the text to which the text box is bound. If
Anchor is specified, the anchor is positioned at the
beginning of the first paragraph in the anchoring range.
If this argument is omitted, the anchoring range is
selected automatically and the text box is positioned
relative to the top and left edges of the page."
There is no example of how this can be achieved, and I need
to attach the anchor to the bookmark. I have tried
everything, yet I'm unsuccessful.
This has been tried in Word 97, 2000, 2002 and 2003. Same
results in all versions. (and don't ask, but the client
needs it to work in all 4 versions. The addtextbox method
has not changed since 97, so I'm thinking that if I
can get it to work, it will work in all these versions).
I would be appreciative of any help you can suggest.
I really just need to attach the anchor to a bookmark. Oh,
and this text must go into a textbox, there is no other
alternative (we don't mention frames around here)
replies to the group, or to the following address:
(e-mail address removed)
<remove no.spam>
Thank you in advance
JP
I have a situation where I add a text box in code and
position it on the page.
This code works perfectly as it stands:
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal,
88#, _
637.35, 445.35, 35.3).Select
BUT
It places the anchor on the last paragraph mark on the
page. I do not want this (even if I tell it not to move the
anchor with the text, it still takes the textbox to page 2
when that paragraph mark is moved to a second page in the
document). It must be attached to a bookmark higher up on
the page.
According to the online help, there is an optional variant
I can add in the arguments to position or attach the anchor
to a range object.
This is quoted from the VBA help (and is reiterated in the
KBase) "Anchor - Optional Variant. A Range object that
represents the text to which the text box is bound. If
Anchor is specified, the anchor is positioned at the
beginning of the first paragraph in the anchoring range.
If this argument is omitted, the anchoring range is
selected automatically and the text box is positioned
relative to the top and left edges of the page."
There is no example of how this can be achieved, and I need
to attach the anchor to the bookmark. I have tried
everything, yet I'm unsuccessful.
This has been tried in Word 97, 2000, 2002 and 2003. Same
results in all versions. (and don't ask, but the client
needs it to work in all 4 versions. The addtextbox method
has not changed since 97, so I'm thinking that if I
can get it to work, it will work in all these versions).
I would be appreciative of any help you can suggest.
I really just need to attach the anchor to a bookmark. Oh,
and this text must go into a textbox, there is no other
alternative (we don't mention frames around here)
replies to the group, or to the following address:
(e-mail address removed)
<remove no.spam>
Thank you in advance
JP