You've done it again Bart and thanks. All in all a button
to do exactly what I want. I swapped "true" with "false"
so that the button is depressed when checkers are off (not
logical but more intuitive).
Slight problem the code relies on the button always
being in the same place and will fail if customising
toolbars moves it. I wonder if something similar would
work based on the ID of the custom menu button assuming it
remains unique and constant regardless of position.
Small tip for anyone else saving the checker code. After
experimenting make sure the checker options are set to
preferred default (on) before saving in normal.dot
Sandy
Quote:
>-----Original Message-----
>Hi Sandy,
>This has been another learning experience for me too.
>But I think I got it.
>First you have to add a button for the macro to a
toolbar. (It is
>probably best to make a new toolbar for your own macro's
and
>functions.)
>When that is done, you add the next lines to the macro
>BarName = "MyBar" ' Use the name of your toolbar
>ButtonNr = 1 ' Assuming the first button on the
bar
> Set c = CommandBars(BarName).Controls(ButtonNr)
> With c
> If Options.CheckSpellingAsYouType = True Then
> .State = msoButtonDown ' SpellCheck = on
> Else
> .State = msoButtonUp ' SpellCheck = off
> End If
> End With
>Information about adding a toolbar and adding a button to
a toolbar
>you can find in the Word Help.
>Good luck!
>Bart
>On Thu, 4 Jul 2002 13:40:13 -0700, "Sandy V"
Quote:
>>Many thanks Bart, perfect. It seems obvious now you
have
>>explained.
>>Yes, I always change Spelling and Grammar as a pair.
>>Depending on the type of doc I'm working with checkers
are
>>either very useful or just annoying. Although looking
>>back at my posting I obviously had the spell checker
off
>>gramArhhhh!
>>Thanks again,
>>Sandy
>>PS A bit presumptious to ask, but would you know how to
>>make one of those in(depressed)/out type toolbar buttons
I
>>can attach to your macro that will visibly show me the
>>state of the checkers.
>>>-----Original Message-----
>>>Hi Sandy,
>>>The next piece of code toggles spelling checking on and
>>of.
>>> With Options
>>> If .CheckSpellingAsYouType = True Then
>>> .CheckSpellingAsYouType = False
>>> ShowSpellingErrors = False
>>> Else
>>> .CheckSpellingAsYouType = True
>>> ShowSpellingErrors = True
>>> End If
>>> End With
>>>But since you want to toggle both grammer and spelling
>>checking, you
>>>have a bit of a problem since there are four states for
>>the two
>>>options:
>>>spelling / grammer
>>>on / on
>>>on / off
>>>off / on
>>>off / off
>>>If you are absolutely sure that boith options are both
on
>>or both off,
>>>it's easy,
>>>In tha case you just add two lines to the above code:
>>> With Options
>>> If .CheckSpellingAsYouType = True Then
>>> .CheckSpellingAsYouType = False
>>> .CheckGrammarAsYouType = False
>>> ShowSpellingErrors = False
>>> Else
>>> .CheckSpellingAsYouType = True
>>> .CheckGrammarAsYouType = True
>>> ShowSpellingErrors = True
>>> End If
>>> End With
>>>Maybe that is the best solution under all circumstances.
>>>Check if spelling checking is on and on the basis of
that
>>change the
>>>state of both options to the opposite of the status of
>>spelling
>>>checking.
>>>Hope this helps,
>>>Bart