PDA

View Full Version : Need Help in Mid Function



Rakesh
07-17-2014, 07:56 AM
HI Rocks,

First I have to thank you all guys who helped me so long. Now I am came with new request

I had a word file which contain some tags (up to first colon ":") in front of the paragraph. In between the tags I have to find some criteria and to Highlight the whole paragraph.

First criteria:
In between the tag I Have to find the Numeric values which comes after hyphen "-" for the First para.
Like as above for the second para.
If the Numeric value mismatch with the second para. The Second para should be highlighted
If the Second para does not contain any numeric after hyphen "-" should compare first para with the third para and to highlight the third para.
Like that throughout the document

If I want to replace it. I will do it in wildcard raplace as below. But I have to compare the mid of the String. I don't know to do it.


ActiveDocument.Content.Find.execute _
FindText:="^13([!^13]@-)([0-9]@c)([!^13]@^13)([!^13]@-)[0-9]@c", _
MatchWildcards:=True, _
ReplaceWith:="^p\1\2\3\4\2", _
replace:=wdReplaceAll

Second Criteria:
Have to count the Tab for the whole para and to compare with the numeric value (after hyphen) in between the tag. If the tab count and Numeric value mismatch, the para should be highlighted.

Third Criteria:
If the para text contains the word "Total" and if the word "rule" is not in between the tag. The para should be highlighted.

Attached file for your reference

Thanks in Advance
Rakesh