M
Mike
Hi, I've got a document that I've been protecting (for Revision tracking
only), and I want to capture the most recent revision date from the
document. For that I've tried to create the code that follows. Everything
seems to be running okay EXCEPT that if I create a watch on myrev, or get
rid of the "on error resume next" statement, you get an "Object has been
deleted" (in the watch) "Run-time error 5852 Requested Object is Not
Available". I can use the immediate window and check that there are in fact
24 revisions currently counted in the document. If I try typing "?
thisdocument.revisions(1).date" I get the same error 5852.
How do I find the most recent revision and get it's date? What am I doing
wrong here? Any ideas?
Sub checker(doc As Document)
If myTrial.myDoc.Name = doc.Name Then
Dim myrev As Revision
Dim revdate As Date
On Error Resume Next
For Each myrev In doc.Revisions
If myrev.Date > revdate Then revdate = myrev.Date
Next myrev
On Error GoTo 0
doc.Variables("CntRevDate") = Format(revdate, "mmm dd, yyyy")
Set myrev = Nothing
End If
End Sub
--
____________________________________________________________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
____________________________________________________________________________
________________
only), and I want to capture the most recent revision date from the
document. For that I've tried to create the code that follows. Everything
seems to be running okay EXCEPT that if I create a watch on myrev, or get
rid of the "on error resume next" statement, you get an "Object has been
deleted" (in the watch) "Run-time error 5852 Requested Object is Not
Available". I can use the immediate window and check that there are in fact
24 revisions currently counted in the document. If I try typing "?
thisdocument.revisions(1).date" I get the same error 5852.
How do I find the most recent revision and get it's date? What am I doing
wrong here? Any ideas?
Sub checker(doc As Document)
If myTrial.myDoc.Name = doc.Name Then
Dim myrev As Revision
Dim revdate As Date
On Error Resume Next
For Each myrev In doc.Revisions
If myrev.Date > revdate Then revdate = myrev.Date
Next myrev
On Error GoTo 0
doc.Variables("CntRevDate") = Format(revdate, "mmm dd, yyyy")
Set myrev = Nothing
End If
End Sub
--
____________________________________________________________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
____________________________________________________________________________
________________