Re: Track Changes VBA Granular information needed
- From: Jay Freedman <jay.freedman@xxxxxxxxxxx>
- Date: Wed, 18 Jun 2008 20:52:23 -0400
We're back to the point where I need to know what you plan to do with the
results before I can suggest specific code. What follows is more general, in the
hope that you can learn to develop the specifics for yourself.
The InStr function takes at least two strings (there could be more arguments,
but let's start simple). If the second string occurs somewhere in the first
string, then the function returns the position of the first matching character
from the start of the first string; otherwise it returns zero. For example,
InStr("abcd", "bc") returns the value 2, while Instr("abcd", "cb") returns 0
because "cb" doesn't occur in "abcd".
Another bit you need to know is that the comparison in InStr is case-sensitive;
that is, "Bc" would not be found in "abcd" because the case of the "B" is
different. When you want to do a comparison that ignores case, convert both
strings to lower case with the LCase() function.
One other thing is that any one .FormatDescription string can contain two,
three, or more separate formatting items. For example, one could be "Font: 12pt,
Bold, Italic". If you're keeping separate track of bold formatting and italic
formatting, you need to test the .FormatDescription string separately for each
item.
So here's a small example; you would replace the MsgBox statements with whatever
it is you want to do with the information about formatting:
Dim oRev As Revision
For Each oRev In ActiveDocument.Revisions
If oRev.Type = wdRevisionProperty Then
If InStr(LCase(oRev.FormatDescription), "bold") > 0 Then
MsgBox "bold included"
End If
If InStr(LCase(oRev.FormatDescription), "italic") > 0 Then
MsgBox "italic included"
End If
If InStr(LCase(oRev.FormatDescription), "font color") > 0 Then
MsgBox "font color included"
End If
End If
Next
--
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.
On Wed, 18 Jun 2008 11:22:01 -0700, Krumrei <Krumrei@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Jay,
Lets say I do want to use the InStr function to extract specific titles in
the revisions properties, such as Italic, bold, etc. etc how to I put that in
my code listed?
Thanks!
.
"Krumrei" wrote:
I have a VBA code that allows me to extract and create a new document and
formatted report of the track changes that happened to the document.
However, I need it to be more specific in what changes.
Sorry for the clarification issue.
1. I need to know what fields ( wdrevisionproperty etc etc. ) I can use to
extract more specific changes.
2. I have a macro built that pulls all document changes, but they only
include Insert and Deletes and Table Cell property changes, and then extracts
them into a new document.
3. I need to dig deeper such as knowing if the change in the document was a
Bold, Italic, Underline or Font or style change, I have 13 different changes
within the document that I want to have on a report, to identify what changes
happened on the document.
Again, I really need to know which VBA wd code I need to use to extract a
more granular piece of what changed, not the high level, insert and delete in
my Macro.
The review pane of the track changes document, outlines more granular
changes in the document, such as Format Font Bold changes, but again, I am
not sure which wd code I need to use to extract that into a report with my
Macro.
Thanks!
- Follow-Ups:
- Re: Track Changes VBA Granular information needed
- From: Krumrei
- Re: Track Changes VBA Granular information needed
- Prev by Date: Re: Track Changes VBA Granular information needed
- Next by Date: Re: Making an automatic subtotal at the bottom of each page
- Previous by thread: Re: Track Changes VBA Granular information needed
- Next by thread: Re: Track Changes VBA Granular information needed
- Index(es):
Relevant Pages
|
Loading