VBA sometimes returns the wrong style information for a paragraph. This happens if the preceeding paragraph is defined as hidden (via style) and hidden is NOT showing.

There's a thread in the VBA forum

More in this thread

Here's a solution I thought might be useful to anyone manipulating styles in a mixed document:

<pre>
Private Function WhatsMyStyle()
' Code Header inserted by the Procedure Header Add-In
'================================================= ============
' WorkAroundFunction.WhatsMyStyle
'-------------------------------------------------------------
' Purpose
' Author : Guy Gallo, 06-01-2002
' Notes :
'-------------------------------------------------------------
' Parameters
'-----------
' none
'-------------------------------------------------------------
' Returns:
' The current paragraphs style name not matter what the
' previous paragraph.
'-------------------------------------------------------------
' Revision History
'-------------------------------------------------------------
' 06-01-2002 :
'================================================= ============
' End Code Header block
Dim aRange As Range
Dim i As Integer

'Get current paragraphs index
i = ActiveDocument.Range( _
Start:=0, End:=Selection.Paragraphs(1).Range.End).Paragraphs .Count

'Assign paragraph mark to a range object.
'This is the key part of the workaround. Query the paragraph mark,
'not the paragraph.
Set aRange = ActiveDocument.Range( _
Start:=ActiveDocument.Paragraphs(i).Range.End - 1, _
End:=ActiveDocument.Paragraphs(i).Range.End)

WhatsMyStyle = aRange.Style

End Function

</pre>