Helmut said:
Hi J,
I don't have all relevant versions of word available,
but I don't think, there are relevant differences concerning
your issue. Maybe the following will shed some light on this.
It is nothing but the coding of paragraph indent vs. style indent,
as Klaus suggested.
---
Dim StyleName As String ' the style name
Dim LeftActPt As Single ' actual left indent in points
Dim LeftDefPt As Single ' default left indent inpoints
Dim LeftActCm As Single ' actual left indent in centimeters
Dim LeftDefCm As Single ' default left indent centimeters
StyleName = Selection.Paragraphs(1).Style
LeftActPt = Selection.Paragraphs(1).LeftIndent
LeftDefPt =
ActiveDocument.Styles(StyleName).ParagraphFormat.LeftIndent
LeftActCm = PointsToCentimeters(LeftActPt)
LeftDefCm = PointsToCentimeters(LeftDefPt)
MsgBox "actual left indent = " & Format(LeftActCm, "#.000 cm")
MsgBox "default left indent = " & Format(LeftDefCm, "#.000 cm")
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
Hi Helmut,
The code below is what I have...(all relevant arrays are declared as
Single).
I think this returns the next styles value for LeftIndent but everything
else looks OK.
Any Ideas?
Cheers
J
Dim Sty As Style
i = 0
For Each Sty In ActiveDocument.Styles
If Not Sty.BuiltIn Then
ReDim Preserve aStyArrName(i)
ReDim Preserve aStyArrSize(i)
ReDim Preserve aStyArrFont(i)
ReDim Preserve aStyArrStyleType(i)
ReDim Preserve aStyArrParAlign(i)
ReDim Preserve aStyArrParaOutLine(i)
ReDim Preserve aStyArrParaLeftInd(i)
ReDim Preserve astyarrparaRightInd(i)
ReDim Preserve astyarrparaSpBef(i)
ReDim Preserve astyarrparaSpAft(i)
ReDim Preserve astyarrparaLineSp(i)
aStyArrName(i) = Sty.NameLocal
aStyArrSize(i) = Sty.Font.Size
aStyArrFont(i) = Sty.Font.Name
If Sty.Type <> wdStyleTypeCharacter Then
aStyArrStyleType(i) = "Paragraph"
aStyArrParAlign(i) = Sty.ParagraphFormat.Alignment
aStyArrParaOutLine(i) = Sty.ParagraphFormat.OutlineLevel
aStyArrParaLeftInd(i) =
PointsToCentimeters(Sty.ParagraphFormat.LeftIndent)
astyarrparaRightInd(i) = Sty.ParagraphFormat.RightIndent
astyarrparaSpBef(i) = Sty.ParagraphFormat.SpaceBefore
astyarrparaSpAft(i) = Sty.ParagraphFormat.SpaceAfterAuto
astyarrparaLineSp(i) = Sty.ParagraphFormat.LineSpacing
Else
aStyArrStyleType(i) = "Character"
End If
i = i + 1
End If
Next