Word object model does not recognize '.:' sequence

G

Guest

Hi,

I am trying to retrieve all the sentences in a particular paragraph. When
the sentence contains the sequence '.:' i.e. dot followed by colon, Word
skips the preceeding sentence. I am using the following code snippet:

for each para in ThisDocument.Paragraphs
for each paraRange in para.Range.Sentences
Debug.Print paraRange.Text
Next
Next

Now what happens when a test like following is present is:

Tel.: +9144535352712

Debug.Print prints:
:
: +9144535352712

The Tel. is completely ignored. The same problem occurs with the ., sequence
too. Currently I am replacing the ., and .: sequences with a special
character for processing. But I do not know how many other such sequences
exist which Word fails to recognize properly. It would be great if anyone
can help me out here.

However sequences that Word recognizes are :
..[any character]
..[any number]
.."
..)


Thanks and Regards,
Laks
 
G

Guest

More sequences are not being recognized by Word.

The non-recognized sequence list:

..| (dot + pipe)
..; (dot + semi-colon)
..` (dot + back quote)
..~ (dot + tilde)
..> (dot + greater than)
..< (dot + less than)
..\ (dot + back slash)
../ (dot + fwd slash)
..@ (dot + AT)
..# (dot + hash)
..$ (dot + dollar)
..^ (dot + caret)
..& (dot + ampersand)
..* (dot + star)
..( (dot + open round bracket)
.., (dot + comma) - for completeness
..: (dot + colon) - for completeness

In all the above cases, Word behave in the same fashion as mentioned below,
ignoring the preceeding sentence. Though some of these might never be used,
some have a greater probabilityof occurance, such as .* or .: or .,.

Thanks and Regards,
Laks
 
G

Greg

Laks,

Here is a little test:

Num.: 123
Num., 123
Num:, 123
Num.? 123
Num.! 123
Num!? 123
Num:, 123
Num:: 123
Num;: 123
Num;, 123
Num;; 123

Sub Test()
Dim oSentence As Range
For Each oSentence In ThisDocument.Sentences
MsgBox oSentence
Next
End Sub


It appears that if you have a any sentence ending puncuation between
Num and the digits then you will have problems.
 
G

Guest

Greg,

Having a sentence ending puntuation in the middle of a sentence is perfectly
fine with me as long as Word recognizes both parts correctly. But the main
problem here is that Word fails to recognize the part of the sentence
preceeding the special sequence (one of the 17 mentioned). That is my main
problem.

Mainly, the '.,' '.:' '.;' are frequently used in Word documents.

Thanks and Regards,
Laks
 
G

Greg Maxey

Laks,

Yes. That is what I was trying to point out. I am afraid that if you use
sentence ending puntuation like '.,' '.:' '.;' then Word isn't goind to
cooperate. I think you are stuck with the work around that you described in
your OP. I believe the scope is limited to the characters here for
practical purposes.
 

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