I am trying to write a macro on my OpenOffice Writer to remove all comments from the active word document, so far the code I have actually researched and cobbled together can be found below.
Sub RemoveAllComments()
Dim i as Integer
For i = doc.Comments.Count To 1 Step -1
doc.Comments(i).Delete
Next i
End sub
My compiler is giving me an "Object variable not set" error and I am not sure how that applies to the code I have cobbled together. I am really new to this and I don't even know what the To 1 Step -1
even means!
I would really appreciate your help!
For OpenOffice Writer 4.0.0 the following code is confirmed to delete all comments in the document.
You're original code is for Microsoft Word and I have provided a solution in that case as well. For Word 2007, 2010, and 2013 the following code will remove all comments in the active document.
The
Count To 1 Step -1
Is saying to start atCount
and count backwards to1
with increments of 1.