Errors in Microsoft Word

I am working with errors in Microsoft Word. With just a few spelling errors, access to the SpellingErrors collection becomes slow (at least with For / Next or For / Each options).

Is there a way to get the list in the list (quickly copy a copy, copy entries, stop the dynamic nature of the collection)? I just need a list, a light snapshot, and for it not to be dynamic or real.

+5
source share
1 answer

Here's how I would model the creation and spelling check:

Sub GetSpellingErrors()
    ''# Turn off auto-spellchecking
    Application.Options.CheckSpellingAsYouType = False
    ''# Set document
    Dim d As Document
    Set d = ActiveDocument
    ''# Insert misspelled text
    d.Range.Text = "I wantedd to beet hym uup to rite some rongs."
    ''# Get spelling errors
    Dim spellErrs As ProofreadingErrors
    Set spellErrs = d.SpellingErrors
    ''# Dump spelling errors to Immediate window
    For spellErr = 1 To spellErrs.Count
        Debug.Print spellErrs(spellErr).Text
    Next
    ''# Turn back auto-spellchecking
    Application.Options.CheckSpellingAsYouType = True
End Sub

, Word 2003, Word 2010. , , . "" "" , " " .

Application.Options.CheckSpellingAsYouType = False. ( squigglies). - - , , Word, .

, Word 2007/2010 ( 2003 ), XML (WordprocessingML). , , VBA , Open XML. Linq-to-XML , IEnumerable . .Value XML w:type="spellStart" w:type="spellEnd" <w:proofErr/>. WordprocessingML:

<w:p w:rsidR="00A357E4" w:rsidRDefault="0008442E">
  <w:r>
    <w:t xml:space="preserve">I </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r>
    <w:t>wa</w:t>
  </w:r>
  <w:bookmarkStart w:id="0" w:name="_GoBack"/>
  <w:bookmarkEnd w:id="0"/>
  <w:r>
    <w:t>ntedd</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r>
    <w:t xml:space="preserve"> to </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r w:rsidR="003F2F98">
    <w:t>b</w:t>
  </w:r>
  <w:r w:rsidR="005D3127">
    <w:t>eet</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r w:rsidR="005D3127">
    <w:t xml:space="preserve"> </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r w:rsidR="005D3127">
    <w:t>hym</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r w:rsidR="005D3127">
    <w:t xml:space="preserve"> </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r w:rsidR="005D3127">
    <w:t>uup</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r w:rsidR="005D3127">
    <w:t xml:space="preserve"> to </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r w:rsidR="005D3127">
    <w:t>rite</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r w:rsidR="005D3127">
    <w:t xml:space="preserve"> some </w:t>
  </w:r>
  <w:proofErr w:type="spellStart"/>
  <w:r w:rsidR="005D3127">
    <w:t>rongs</w:t>
  </w:r>
  <w:proofErr w:type="spellEnd"/>
  <w:r w:rsidR="005D3127">
    <w:t xml:space="preserve">. </w:t>
  </w:r>
</w:p>
+5

All Articles