A table would do the same thing. The thing about text boxes is that they are
not in the same "layer" of the document as your regular text. It adds a big
level of complexity. If you want something in a margin, you could put it in
a frame (which acts a lot like a text box, but is still in the text layer).
The following code creates a frame with a SaveDate field for the left
margin.
Sub Macro6()
'
' Macro6 Macro
' Macro recorded 4/13/2006 by Charles Kyle Kenyon
'
With Selection
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"SAVEDATE \@ ""d-MMM-yy"" ", PreserveFormatting:=False
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
ActiveDocument.Frames.Add Range:=Selection.Range
With .Frames(1)
.Select
.TextWrap = True
.WidthRule = wdFrameExact
.Width = InchesToPoints(0.8)
.HeightRule = wdFrameAuto
.HorizontalPosition = wdFrameLeft
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.VerticalPosition = InchesToPoints(0)
.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
.HorizontalDistanceFromText = InchesToPoints(0.1)
.VerticalDistanceFromText = InchesToPoints(0)
.LockAnchor = False
End With
.Collapse
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.TypeText Text:="Saved"
.TypeParagraph
End With
End Sub
It is very sloppy, based on recording. Run it to get a frame. Adjust the
formatting of the frame and the field until they are to your liking. Save
this as an AutoText entry.
Then, write your code to find date fields and in place of the date field
insert the Autotext entry, which will be the framed SaveDate field.
Hope this helps. I'm sure there is a more elegant way.
--
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
--------- --------- --------- --------- --------- ---------
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.