Helmut said:
Hi,
e.g.:
With ActiveDocument.Styles("Titel").ParagraphFormat
MsgBox .TabStops.Count
MsgBox .TabStops(1).Position
End With
Need help on looping, too?
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
HI Helmut,
I'm able to read the info from the document and store in an .ini file,
but when I try to write the tabstops back it fails, usually setting the
first tab stop to 0cm but with the correct alignment and leader info.
Here's what I have so far...
Reading from document -
With sty.ParagraphFormat
ReSizeMultiDim i, "Tabs"
For y = 1 To .TabStops.Count
With .TabStops(y)
Test = .Position
If Len(Test) <> 0 Then
aStyArrParaTabPos(y, i) = Format(PointsToCentimeters(.Position), "0.00")
If Right(aStyArrParaTabPos(y, i), 2) = "00" Then
aStyArrParaTabPos(y, i) = Format(aStyArrParaTabPos(y, i), "0")
End If
aStyArrParaTabAlign(y, i) = .Alignment
aStyArrParaTabLeader(y, i) = .Leader
End If
End With
Next y
Writing back to document -
With mystyle.ParagraphFormat
ReSizeMultiDim i, "Tabs"
For y = 0 To lTabCount - 1
If mystyle.ParagraphFormat.TabStops.Count <= lTabCount Then
If Len(aStyArrParaTabPos(y, i)) <> 0 Then
mystyle.ParagraphFormat.TabStops.Add _
Position:=CentimetersToPoints(aStyArrParaTabPos(y, i)), _
Leader:=aStyArrParaTabLeader(y, i), _
Alignment:=aStyArrParaTabAlign(y, i)
If Right(aStyArrParaTabPos(y, i), 2) = "00" Then
aStyArrParaTabPos(y, i) = Format(aStyArrParaTabPos(y, i), "0")
End If
With .TabStops(y)
.Position = PointsToCentimeters(aStyArrParaTabPos(y, i))
.Alignment = aStyArrParaTabAlign(y, i)
.Leader = aStyArrParaTabLeader(y, i)
End With ' tabstops
End If
End If
Next y
End With 'mystyle
Cheers
J