I have the following macro that inserts a note table into my document. When I
add my text the margins works just fine for the first paragraph. But if I
start a new paragraph the margin goes all the way back to the left. How do I
keep all the paragraphs lined up?
Sub NoteBox()
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _
1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
Selection.Tables(1).Rows.SetLeftIndent LeftIndent:=5.4, RulerStyle:= _
wdAdjustNone
Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=498, RulerStyle:= _
wdAdjustNone
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.5)
Selection.Font.Underline = True
Selection.TypeText Text:="NOTE"
Selection.Font.Underline = False
Selection.TypeText Text:=":" & vbTab
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0.75)
.FirstLineIndent = InchesToPoints(-0.75)
End With
End Sub
Klaus Linke - 28 Feb 2007 06:13 GMT
It would probably be better to assign a paragraph style with the proper
hanging indent.
Not sure why you have the problem though, since Word usually keeps the
(manual) paragraph formatting when you start a new paragraph by hitting
Return.
Maybe the "Style for following paragraph" setting in the style definition
makes Word swith to another style?
Regards,
Klaus
>I have the following macro that inserts a note table into my document. When
>I
[quoted text clipped - 23 lines]
> End With
> End Sub