Run-time error '5904' Cannot edit range.
Hello, I am running the following macro:
Sub ScratchMacroI()
Dim oRng As Word.Range
Dim oRngDelete As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "word"
While .Execute
oRng.Select
Set oRngDelete = ActiveDocument.Bookmarks("\Line").Range
oRngDelete.Delete
Wend
End With
End Sub
Sub ScratchMacroII()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "word"
While .Execute
oRng.Paragraphs(1).Range.Delete
Wend
End With
End Sub
It runs fine for awhile and then gets hung up on the run time error. I should mention the document I have is 200+ pages and is filled with tables. I have attached a sample of what these tables look like.
|