Meanings and usages of sentences, paragraph, etc. in Word

Source: Internet
Author: User

Word has words,characters,sentences, paragraph,sections specific meanings are as follows
Object returned by expression meaning
Words (index) Word Range
Characters (index) character Range
Sentences (index) sentence Range
Paragraphs (index) Paragraph Paragraph
Sections (Index) section
In general, a document is composed of several sections (Sections), a section with several paragraphs (paragraphs),
Each paragraph has a few sentences (sentences) composition, each sentence and a few words words composition, each word has a few characters composition
The following documents, there are two sections, three paragraphs, probably as follows, see annex
Excelhome is a good site, you are not just execl home, but also word,ppt home, we all like you. I hope you're doing better.
Gisoracle is a good person and he does a lot of software about Word,ppt. such as word turn picture Pdf,word numbering tool, Word to picture word;ppt convert picture pdf,ppt convert picture ppt, I want his software.
--There are section breaks
Microsoft Office is doing well and believes he will do better.
VBA is as follows
Private Sub CommandButton1_Click ()
MsgBox "Current document has" & ActiveDocument.Sections.Count & "section"
Dim I, J as Integer
i = 1
Dim osection as section

For each osection in Activedocument.sections
MsgBox "The current document section" & I & "section:" & OSection.Range.Text
i = i + 1
Next

MsgBox "Current document has" & ActiveDocument.Paragraphs.Count & "segment"

i = 1
Dim Oparagraph as Paragraph
Dim Osentence as Range

For each oparagraph in activedocument.paragraphs

MsgBox "Current document section" & I & "section," Content: "& OParagraph.Range.Text
j = 1

For each osentence in oParagraph.Range.Sentences
MsgBox the contents of the "Current document section" & I & ", section" & J & "sentence:" & Osentence.text
j = j + 1
Next

i = i + 1

Next
i = 1

Dim oword as Range

For each oword in Activedocument.words
MsgBox "Current document section" & I & "Word," content: "& oword. Text
If i = 1 Then

For j = 1 to oword. Characters.count
MsgBox "Current document section" & I & "Word:" & J & "character:" & oword. Characters.item (j). Text
Next

End If

i = i + 1

Next


End Sub

Meanings and usages of sentences, paragraph, etc. in Word

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.