Re: Track Changes VBA Granular information needed

Tech-Archive recommends: Fix windows errors by optimizing your registry



One last question.

I want to pull comments in the program too.

I added this.


Dim cmt = Comments


ElseIf ocmt.Range.Text = "0" Then
.Cells(3).Range.Text = "Comments"


Was wondering what Range, comments are under, or wd Properties?




Thanks!















"Krumrei" wrote:

I so owe you a beer!


Adding that oRevision in the .Range was what the issue was!

Super, thank you so much for the 22 some odd replies!


You are great!


Paul






"Jay Freedman" wrote:

I have a suspicion, but I can't tell by looking at just this little bit of
the code...

When you write .Range.Text, or any expression that starts with a dot, that
assumes there is a line

With oRevision

somewhere before that (and a matching End With somewhere afterward) to
specify _which object_ you're getting the range from. I think you've left
that part out, so the .Range is referring to whatever object you _do_ have a
"With" statement for -- probably ActiveDocument. Of course, the range of
that object isn't going to be just a comma, so the If condition will always
be false.

The most effective fix will be to include the oRevision object in each If
statement, like

If oRevision.Range.Text = "," Then

so there's no ambiguity about which object is being used there.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Krumrei wrote:
This code works.

ElseIf oRevision.Type = wdRevisionDelete Then
.Cells(3).Range.Text = "deleted"
'Apply automatic color (black on white)
oRow.Range.Font.Color = wdColorAutomatic


Then when I add this, it still pulls the "deleted" text, but not in
Cell(3) with the words "deleted" It is not grabbing the text range.



ElseIf oRevision.Type = wdRevisionDelete Then
If .range.text = "," Then
.Cells(3).Range.Text = "Comma Deleted"
'Apply automatic color (black on white)
oRow.Range.Font.Color = wdColorAutomatic
End If




.


Quantcast