Hi friends,
Something is getting me a bit confused here. I am currently developing an app which will allow me to check tech doc. for common errors, such as wrong terminology, awkward style, or simply double spaces, space before punctuation etc.
For this, I stored terminology, forbidden terms, and regexp patterns and replacements in a database.
On executing a check on an opened document, I query this db, execute the REGEXPs and display the affected segment in a user form together with the suggested correction - and this is where the problem lies:
The "Selection" Range is set to the affected text portion, but word won't visibly "jump" to said position!
Here's some code snippet, hope it'll help you see the problem:
The bolded part is what should make the document display jump to that sentence. Alas it doesn't!
Why?
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Thanks for any hint!
Cheers,
Andy
[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
Something is getting me a bit confused here. I am currently developing an app which will allow me to check tech doc. for common errors, such as wrong terminology, awkward style, or simply double spaces, space before punctuation etc.
For this, I stored terminology, forbidden terms, and regexp patterns and replacements in a database.
On executing a check on an opened document, I query this db, execute the REGEXPs and display the affected segment in a user form together with the suggested correction - and this is where the problem lies:
The "Selection" Range is set to the affected text portion, but word won't visibly "jump" to said position!
Here's some code snippet, hope it'll help you see the problem:
Code:
Set rs = con.Execute("SELECT * FROM expressions")
Do While Not rs.EOF
pat = rs("expression").Value
rep = rs("replacement").Value
comt = rs("comment").Value
Act = rs("action").Value
With objRegEx
.Global = True
.IgnoreCase = False
.MultiLine = True
.Pattern = pat
Set objMatch = .Execute(ActiveDocument.Content.Text)
End With
For Each mMatch In objMatch
...
...
[b]Selection.SetRange mMatch.FirstIndex + 1, mMatch.FirstIndex + mMatch.Length - 2
Selection.SetRange Selection.Sentences(1).Start, Selection.Sentences(1).End[/b]
Why?
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Thanks for any hint!
Cheers,
Andy
[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell