Sub ListRevPages()
Dim rv As Revision
For Each rv In ActiveDocument.Range.Revisions
MsgBox rv.Range.Information(wdActiveEndPageNumber) '<---stops here.
Next rv
End Sub
TIA
Mark Tangard <mtan...@speakeasy.net>, Microsoft Word MVP
"Life is nothing if you're not obsessed." --John Waters
I can't reproduce your problem - WordXP SP1. I don't get the error with
revisions in a Table. Do you want to send over a test document ?
---
ibby
"Mark Tangard" <mtan...@speakeasy.net> wrote in message
news:3CC61D03...@speakeasy.net...
I *do* get the error in Word 2000 SR-1. If I bring up rv in a watch window when the error occurs, it
says "<Object has been deleted.>"
This is just an ordinary 4-page document to which I added a small table on page 3, and one revision
on each page. If the revision on page 3 is outside the table, no problem; but make a revision in the
table, and the macro falls over.
--
Regards,
Jay Freedman
Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
"ibby" <ib...@bigpond.net.au> wrote in message news:eUHegJ16BHA.584@tkmsftngp03...
The only way that I found to get around this is to use the
selection object.
Mark Baird
>.
>
Could you elaborate on how you'd use the Selection object to
work around this? I don't see how.
(This is indeed Word 2000 SR-1. Thanks to Jay for proving
I'm not going mad....)
--
Mark Tangard <mtan...@speakeasy.net>
"Life is nothing if you're not obsessed." --John Waters
I think the other Mark means something like
Sub ListRevPages()
Dim rv As Revision
Dim posOld As Long, posNew As Long
Selection.HomeKey (wdStory)
Set rv = Selection.NextRevision(True)
Do Until posNew < posOld
MsgBox Selection.Information(wdActiveEndPageNumber)
Selection.Collapse (wdCollapseEnd)
Set rv = Selection.NextRevision(True)
posOld = posNew
posNew = Selection.start
Loop
End Sub
Regards, Klaus
When the revision inside a table is picked by my code (selection.nextrevision), the
whole row is selected. That's when VBA seems to falter. It doesn's seem to be able
to handle the whole row, with all the cells, cell text, and the chr(7) character
in each of those cells.....
I was able to skip the table with the following:
If selection.information (wdwithintable) then
selection.expand wdtable
selection.collapse wdcollapseend
and then start your loop of finding revisions again.
Sesha Reddigari
Mark Tangard <mtan...@speakeasy.net> wrote in message news:<3CC61D03...@speakeasy.net>...
Mark
I'm not sure I know why it works myself ;-)
and much less why your code didn't...
The revisions in tables seem to exist and not exist at the same time,
like ghosts.
Selection.NextRevision(Wrap:=True) seems to work.
Since I didn't find a way to count the revisions and stop at the last
one, I set Wrap:=True, and checked if I had passed the end of the
document (posNew<posOld).
Like Sesha I think the bug is caused by Word not treating the
end-of-cell markers the same way as paragraph marks. A few days ago,
there was a problem in the tables newsgroup where OutlinePromote and
OutlineDemote didn't work for paragraphs in table cells. I'd be
surprised if there is an easy explanation for bugs like this. Probably
the internal storage format for tables, revisions ... got so complex
that hardly anybody at Microsoft understands what is going on any
more.
Greetings, Klaus