Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    View Spelling & Grammar Problem???

    I'd like to have a couple of tool bar buttons I can use to turn the little spelling and grammar squiggles on and off. I have a pair of macros, basically copied from the Word VB Reference help file, and they're connected to tool bar buttons but they don't seem to do anything. One of them is shown bellow. Any ideas?

    Sub View_Errors()
    '
    ' View_Errors Macro
    '
    Options.CheckGrammarAsYouType = True
    Options.CheckSpellingAsYouType = True
    ActiveDocument.ShowGrammaticalErrors = True
    ActiveDocument.ShowSpellingErrors = True

    End Sub

    Thanks
    Thanks,

    C DeWitt

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    That's the correct syntax for turning on checking and putting the wavy lines under the "bad" words.

    I suspect your problem is with the assignment of these macros to the toolbar buttons. Try that again. And make sure you've got a 'misspelled' word in your doc so you can see the wavies (sorry, didn't mean to insult your intelligence).

    Incidentally, you can get away with just one button if you like (as long as both boxes start out checked our unchecked):

    Sub SwitchWavies
    With Options
    .CheckSpellingAsYouType = not .CheckspellingAsYouType
    .CheckGrammarAsYouType = not .CheckGrammarAsYouType
    end with
    with ActiveDocument
    .ShowGrammaticalErrors = not .ShowGrammaticalErrors
    .ShowSpellingErrors = not .ShowSpellingErrors
    end with
    end sub
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    I don't think there's anything wrong with the assignment to the toolbar buttons, I can set breakpoints in the macros, click the buttons and be dropped right in the middle of the macro but nothing happens. The "wavies" don't change.
    Thanks,

    C DeWitt

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    What happends when you manually check the boxes under Tools>Options? Do you get the wavies then?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    If I manualy check or uncheck the boxes in Tools>Options it works just as expected. The appropriote wavie is displayed or not as you check or uncheck the box.

    I should also add that if I click the button that should hide the spelling/grammatical errors, the box to hide these errors in Tools>Options is checked but grayed out, you can not then manualy uncheck them and the wavies are still displayed. I must click the button (run the macro) to view spelling/grammatical errors to get these options unchecked and un grayed. After that everything is back to normal.
    Thanks,

    C DeWitt

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: View Spelling & Grammar Problem???

    Try this to force Word to update its spell check:

    Sub SpellToggle()
    With Options
    If .CheckSpellingAsYouType = True Then
    .CheckSpellingAsYouType = False
    Else
    .CheckSpellingAsYouType = True
    End If
    End With
    ActiveDocument.SpellingChecked = False
    End Sub

    Word seems to change the "hide errors" property for me, so I left it out. (I also left out grammar for personal reasons!)

  7. #7
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    No different. I copied your version of the macro and put it on the tool bar. I also tried adding the "ActiveDocument.SpellingChecked = False" line to my original macros. In either case when you run a macro that should turn the wavies off nothing happens to what's displayed on the document and the "Hide spelling/grammatical errors in this document" boxes on the Tools>Options dialog box are checked and grayed out. Running a macro that should toggle it the other way clears the checks and graying.
    Thanks,

    C DeWitt

  8. #8
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    Hi Chris,

    I did tests turning spelling on and off. I discovered that, if I changed the view, it started displaying/not displaying errors. I did it by adding or removing the Ruler from the View Menu. If you add code that toggles that back and forth, it works fine. For example,

    Options.CheckSpellingAsYouType = True
    ActiveWindow.ActivePane.DisplayRulers = Not ActiveWindow.ActivePane.DisplayRulers
    ActiveWindow.ActivePane.DisplayRulers = Not ActiveWindow.ActivePane.DisplayRulers

    HTH,

    Chris

  9. #9
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    Gee... I shoulda known that (ya right).

    Thanks all you peoples!
    Thanks,

    C DeWitt

  10. #10
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    I never said it was elegant <g>...or intuitive <bg>...or documented... <vbg>

  11. #11
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Mundelein, Illinois, USA
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    Hey... As long as it works. Form follows function.
    Thanks,

    C DeWitt

  12. #12
    New Lounger
    Join Date
    Dec 2000
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View Spelling & Grammar Problem???

    Hi Chris,

    I do this without writing macros. I just customize a toolbar as follows:

    select Tools | Customize ...
    then click the "Commands" Tab, Categories: Tools,
    then drag the "Hide Spelling Errors" and "Hide Grammar Errors" commands to the toolbar of my choice.
    Clicking them then toggles the wavy lines on or off.

    Cheers,
    Margaret Hassall

Posting Permissions

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