Hi,
I am using Word.Application.Document.Sentences to get all sentences in
a word document. By default, the VBA would return sentences delimited
by full stop. How could I change it to look for other delimiters, such
as a comma, or even custom define it?
For example, these are 2 sentences in a paragraph:
{##1##}The brown fox jumps over the lazy dog. {/##1##}{##2##}The brown
fox jumps over the lazy dog. {/##2##}
If I use Word.Application.Document.Sentences in a loop, it would return
me 3 lines:
line 1: {##1##}The brown fox jumps over the lazy dog.
line 2: {/##1##}{##2##}The brown fox jumps over the lazy dog.
line 3: {/##2##}
What I need is to have only these 2 sentences:
line 1:{##1##}The brown fox jumps over the lazy dog. {/##1##}
line 2:{##2##}The brown fox jumps over the lazy dog. {/##2##}
Please help. Thank you in advance.
Jonathan West - 20 Oct 2005 14:19 GMT
Hi khairule
Short answer is that you can't do this directly. The best thing to do is to
load the entire text of the document into a string variable, and then
process the string in whatever way you want. You can get the entire
unformatted text of the document into a string by assigning the
ActiveDocument.Content.Text property to a string.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> Hi,
>
[quoted text clipped - 19 lines]
>
> Please help. Thank you in advance.