Check for a horizontal line
I have an application that inserts a horizontal line in a Word document. I want to check if a horizontal line has already been inserted in the prior line. In other words, I don't want to insert a second horizontal line if there is already one there.
I am using this code to check the prior line. It tells me there is an inline shape, but not if it is a line. Can anyone help me establish if the inline shape is a horizontal line.
Selection.MoveUp
If Selection.InlineShapes.Count = 0 Then
Selection.MoveDown
' Create the line
Selection.InlineShapes.AddHorizontalLineStandard
' Line size and alignment
Set shpLine = ThisDocument.InlineShapes(ThisDocument.InlineShape s.Count)
shpLine.HorizontalLineFormat.PercentWidth = 80
shpLine.HorizontalLineFormat.Alignment = wdHorizontalLineAlignRight
End If
|