Gee thanks Macropod. Your non-answer turns up at the top of google search, marked "solved".
Here's a sample, for inserted lines.
Sub R___Lines_ReplaceAllWithString_wdInLineShapeHorizo ntalLine_ForEachLoop()
' deletes lines inserted by borders>horizontal line
'1.===== Name pre-selected range (if LOOP is going to be executed or called on a TABLE) R___PRESELECTED_RANGE_SetAndRESELECTafterLOOPS Macro
Dim PRESELECTED_RANGE As Range
'1a.________ if no selection, msgbox select all, dont select or exit
If Selection.Range = "" Then
SELECT_RANGE = MsgBox("Select whole document?" & vbNewLine & _
"Cancel to make selection manually!" & vbNewLine & _
"No will run only on the selection type the cursor is in.", _
vbYesNoCancel + vbDefaultButton2)
If SELECT_RANGE = vbYes Then
Selection.WholeStory 'selects whole document - then save selection below
ElseIf SELECT_RANGE = vbCancel Then
Exit Sub
End If 'SELECT_RANGE options (will continue with no selection made if yes or cancel not pressed)
End If
'1b.________ set preselected range
Set PRESELECTED_RANGE = Selection.Range 'needs to be set after every preselected range dim, and after every loop
'2.====== CODE range.[QUALIFIER] - loop actions on range here - eg:
Dim INLINE_SHAPE As InlineShape
For Each INLINE_SHAPE In PRESELECTED_RANGE.InlineShapes 'range MUST specify object types
' For Each INLINE_SHAPE In Selection.InlineShapes
With INLINE_SHAPE
If INLINE_SHAPE.Type = wdInlineShapeHorizontalLine Then
INLINE_SHAPE.Select
' If MsgBox("Horiz line, replace?", vbYesNoCancel + vbDefaultButton2) = vbYes Then
' INLINE_SHAPE.Delete
Selection.TypeText Text:="|L|"
' End If
End If
End With
Next
'3.====== reselect range for exit or next action (in MAIN macro, before LOOP macros called, +after each "next" command)
'!!!!!!!!!!!! repeat in called macros
PRESELECTED_RANGE.Select 'add after every "next" - for exit or next procedure
End Sub
|