VBA Code Question

K

Krumrei

I need to know how to add wdRevisionProperty to this code and have it display

I have a code that takes the insert and delete and extracts it to the track
changes documentment I have created.

However, how do I get it to display not only the INSERT and DELETED items
like below, but also this Do I use an ELSE?


..Cells(3).Range.Text = "Property"
'Apply red color
oRow.Range.Font.Color = wdColorRed








'Type of revision
If oRevision.Type = wdRevisionInsert Then
.Cells(3).Range.Text = "Inserted"
'Apply automatic color (black on white)
oRow.Range.Font.Color = wdColorAutomatic

Else
.Cells(3).Range.Text = "Deleted"
'Apply red color
oRow.Range.Font.Color = wdColorRed

--->> Need to add that code here to add the wdRevisionProperty changes
that are tracked.
End If
 
J

Jay Freedman

This post would be better placed in the microsoft.public.word.vba.beginners
group
(http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.word.vba.beginners).
If you have any further questions about this or anything else in your macro,
please post there.

You can use a construction like this:

If oRevision.Type = wdRevisionInsert Then
' do something for inserts
ElseIf oRevision.Type = wdRevisionDelete Then
' do something for deletes
ElseIf oRevision.Type = wdRevisionProperty Then
' do something for property
Else
' it's some other revision -- do nothing
End If

However, when there are three or more exclusive possibilities, it's more
efficient -- and easier to understand and maintain -- to use a Select Case
structure like this:

Select Case oRevision.Type
Case wdRevisionInsert
' do something for inserts
Case wdRevisionDelete
' do something for deletes
Case wdRevisionProperty
' do something for property
Case Else
' it's some other revision -- do nothing
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top