View Single Post
 
Old 01-06-2016, 09:40 PM
NevilleT NevilleT is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Mar 2015
Posts: 29
NevilleT is on a distinguished road
Default 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
Reply With Quote