![]() |
#16
|
|||
|
|||
![]() Quote:
In order to search what in the document was causing this issue, I went through every revision in the document from the beginning, using Word's FindNextRevision button. Surprisingly, a revision in a table was causing an endless loop. Pressing the FindNextRevision button repeatedly still resulted in circling around the revised word in the table. I have no idea what caused this particular revision to behave this way, but I think that part was wreaking havoc with the macro. When I accepted the revision in the table, I no longer experienced the run-time error. |
#17
|
||||
|
||||
![]()
Your mention of revisions within a table reminded me of: http://support.microsoft.com/kb/913804. According to http://support.microsoft.com/kb/841539, this was fixed in Office 2003 Service Pack 2, which raises thequestion: Do you have Office 2003 Service Pack 2 or later installed?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#18
|
|||
|
|||
![]() Quote:
I checked my Word version in the Help menu, and I have Service Pack 3 even. Not a firm believer in the robustness of Microsoft's operation, I refused to give MS the benefit of the doubt and personally went to see the registry under HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\W ord\Options. Surprise! (Well, actually I wasn't surprised.) There was still no AlternateRevisionStepThrough key in there. I have no idea what transpired when Service Pack 3 was installed, but the key must have been removed some time ago if Service Pack 2 had ever installed it. Anyways, I've manually inserted the key, as instructed by the Knowledge Base, and the problem is gone! Thanks so much! |
#19
|
|||
|
|||
![]()
And the long saga continues.
Would a picture (inserted as a file through Insert-Picture command) cause an error with this macro? I inserted a JPG file in the document and started facing run-time error 5917. |
#20
|
||||
|
||||
![]() Quote:
On Error Resume Next before: For i = 1 To .Revisions.Count That should allow the macro to skip over such errors.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#21
|
|||
|
|||
![]() Quote:
It turns out that Word sometimes ignores apparently deleted text in running through revisions. I noticed it after the revision count macro seemingly did not subtract the deleted words. I modified the function so I can see each deleted revision that Word (or the macro here) goes through. Sure enough, Word skips some deleted revision. The behavior is really erratic. Sometimes the same deleted portion would be recognized by the macro, and other times not. I can't really figure out what's causing it. Any idea? Code:
Function CountNetRevisions(Rng As Range) As Long Dim i As Long, j As Long, Str As String With Rng On Error Resume Next For i = 1 To .Revisions.Count If .Revisions(i).Type = wdRevisionInsert Then j = j + .Revisions(i).Range.ComputeStatistics(wdStatisticWords) ElseIf .Revisions(i).Type = wdRevisionDelete Then MsgBox (.Revisions(i).Range.Text) Str = Trim(.Revisions(i).Range.Text) Str = Replace(Str, vbCr, " ") While InStr(Str, " ") > 0 Str = Replace(Str, " ", " ") Wend j = j - (UBound(Split(Str, " ")) + 1) End If Next End With CountNetRevisions = j End Function |
#22
|
||||
|
||||
![]()
I've been OS for 3½ months, hence the delay in replying. Are you sure it's a deletion that's being missed, and not a move?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
![]()
Yes, I think you can easily reproduce the symptom by starting a new document, typing a few sentences and playing around with them.
|
#24
|
||||
|
||||
![]()
I've done that and haven't found any anomalies. Perhaps you could post a document that demonstrates the problem and describe how you went about creating the scenario.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#25
|
|||
|
|||
![]()
Posting a document that can demonstrate this problem is tricky. I think it's situation-dependent rather than document-dependent. I can save a document but when I open it in a new session, the symptom goes away. I'll try to figure out when exactly this problem takes place.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
g48dd | Excel | 2 | 03-13-2011 09:28 PM |
Added letters to body message | kawzie | Outlook | 1 | 07-12-2010 11:00 AM |
![]() |
maruchi | Project | 1 | 06-17-2010 08:06 AM |
Form field to automatically be added to header? | razberri | Word VBA | 3 | 02-22-2010 03:48 PM |
![]() |
UrbanEast | Outlook | 2 | 07-17-2009 09:32 PM |