Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jan 2005
    Location
    Boston, Massachusetts, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Overriding Words Spell-Check (2000/2002/2003)

    Hey Guys,

    I have a Word Spell-Check question for you. I am trying to override Words spell-checking (via the ToolsProofing event) for some users who have Word documents with multiple sections but they only want to spell check the 2nd section. They are therefore irritated no end when Word throws up spelling errors in sections they don't really care about when they hit F7 (to run a document spell check). It's not an option to ask them to highlight what they want to spell-check, that would be too time consuming for them [img]/forums/images/smilies/wink.gif[/img]

    I have created an override for ToolsProofing (snippet of the code included below) and this works well accept for one thing.

    Normally when running a spell-check Word allows you to have the spelling and grammar window open and make changes to the main Word document, when I call CheckGrammar (or CheckSpelling) using VBA code this window gets displayed modally, therefore preventing them from editing the document at the same time the SpellCheck is running. I personally didn

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Why not simply select all the text in the sections that you don't want to check and use Tools > Language > Do not check spelling and grammar?

    StuartR

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> He did already say they would find this 'too time-consuming'
    Beryl M


  4. #4
    New Lounger
    Join Date
    Jan 2005
    Location
    Boston, Massachusetts, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Yes, basically all I want to do is override the spellchecker, when they hit F7 and have word display it's spell-check dialog box non-modally to allow the users to make changes to the main document while spell-check is running.

    I don't understand why when i call this dialog in a Macro the spell-check dialog is modal and when it's used normally through word it isn't.

    You can see what I mean using the following example taken from the Macro recorder of me hitting F7, the resulting dialog is modal.

    <pre>Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 4/20/2005 by sysadmin
    '
    If Options.CheckGrammarWithSpelling = True Then
    ActiveDocument.CheckGrammar
    Else
    ActiveDocument.CheckSpelling
    End If
    End Sub</pre>


  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    If the dialog was non-modal, the rest of the macro would run on while the dialog was displayed. Making it modal means that the macro waits until the dialog is closed before continuing.

  6. #6
    New Lounger
    Join Date
    Jan 2005
    Location
    Boston, Massachusetts, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Ok thanks, I follow that logic.

    So what we are saying is that it is the standard behavior of opening any Word dialog through a macro for it to behave modally? It's really not that I care that the code waits, in this situation I'd rather it didn't as the users see this a different behavior to the norm, and I quote "The only thing I can do if I need to correct in the body of the report, is to close out spellcheck, make my correction and then start F7 again."

    Has anyone had any luck displaying a non-modal dialog? I've found I can use the following command also to display the Spell-check dialog but it too displays modally.

    <pre>Dialogs (wdDialogToolsSpellingAndGrammar)
    </pre>


  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> I had assumed that the document was prepared by someone else and the only part the user was editing was section 2. In this case it would be possible to give the user a document where the parts they didn't write are marked "do not check spelling or grammar"

    StuartR

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Consider the following code from the first post in this thread, a bit simplified to show only the essential parts:
    1. <LI>Set rngToSpellCheck = ActiveDocument.Sections(2).Range
      <LI>rngToSpellCheck.CheckSpelling
      <LI>If rngToSpellCheck.SpellingErrors.Count = 0 Then
      <LI> MsgBox "The spelling check is complete.", vbInformation, "Microsoft Word"
      <LI>End If
    If the spell check dialog was displayed non-modally in line 2, the macro would immediately continue with lines 3-5. But since the user hasn't had the chance to correct any spelling errors yet, SpellingErrors.Count will probably not be 0.

    Edited by HansV to correct a spelling error <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

  9. #9
    New Lounger
    Join Date
    Jan 2005
    Location
    Boston, Massachusetts, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    StuartR

    I am interested in your idea of marking a section not for spell checking, is that a Word property that can be set? I wasn't able to find one when examining the Sections object. If it exists this would be ideal as no new spell-check code would be needed.

    Just a little more info these 3 section documents are multiple documents that users are editing several of per hour, each comes down with info in sections 1 and 3 that is 'informational only' and doesn

  10. #10
    New Lounger
    Join Date
    Jan 2005
    Location
    Boston, Massachusetts, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Hi

    I was able to mark the Sections as having their GrammarChecked and SpellingChecked and therefore now when the users hit F7 they won't be bothered by spelling/grammar errors in these sections.

    Thanks guys for giving me the idea of tackling this from another angle,
    <pre>Sub setchecked()

    ThisDocument.Sections(1).Range.GrammarChecked = True
    ThisDocument.Sections(1).Range.SpellingChecked = True

    ThisDocument.Sections(3).Range.GrammarChecked = True
    ThisDocument.Sections(3).Range.SpellingChecked = True

    End Sub
    </pre>


  11. #11
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Overriding Words Spell-Check (2000/2002/2003)

    Well done, that should be OK for you.

    If you wanted to make this a permanent attribute then you could select the text and from the Tools menu select Language > Set Language and then mark the check box "Do not check spelling and grammar". Then you won't need a macro to prevent these sections being checked in fugure.

    StuartR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •