+ Reply to Thread
Results 1 to 3 of 3

Supressing SpellChecker dialogbox

  1. #1
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    315

    Supressing SpellChecker dialogbox

    I need the right syntax to prevent the Spell Check dialog from showing when it otherwise would upon encountering a wrong word. In such instance, I will rather prefer (to meet a special need ) to have a Msgbox displayed simply indicating there is a "problem". I tried the following code and failed, with the Speller dialog popping up each time ... in spite of negating DisplayAlerts.

    Sub SuppressSpeller()

    Application.DisplayAlerts=False
    x= Cells.CheckSpelling
    If x =True then Msgbox "Spell error"
    Application.DisplayAlerts=False

    End Sub

    TIA

    David

  2. #2
    Jim Rech
    Guest

    Re: Supressing SpellChecker dialogbox

    There are several forms of the CheckSpelling method. The Application form
    does not display the dialog but has to be given the actual text you want
    checked, rather than the range you want checked:

    ?application.CheckSpelling("the cat has a hat")
    True
    ?application.CheckSpelling("the cat has a kat")
    False

    So you'd have to write code to pull the range's text into a variable, maybe
    a cell at a time, and then use that variable with CheckSpelling.

    Sub Example()
    Dim Cell As Range
    For Each Cell In Range("A1:A10").SpecialCells( _
    xlCellTypeConstants, xlTextValues)
    If Application.CheckSpelling(Cell.Value) = False Then
    MsgBox "Error in cell " & Cell.Address
    End If
    Next
    End Sub


    --
    Jim
    "davidm" <[email protected]> wrote in
    message news:[email protected]...
    |
    | I need the right syntax to* prevent* the Spell Check dialog from showing
    | when it otherwise would upon encountering a wrong word. In such
    | instance, I will rather prefer (to meet a special need ) to have a
    | Msgbox displayed simply indicating there is a "problem". I tried the
    | following code and failed, with the Speller dialog popping up each time
    | .. in spite of negating DisplayAlerts.
    |
    | Sub SuppressSpeller()
    |
    | Application.DisplayAlerts=False
    | x= Cells.CheckSpelling
    | If x =True then Msgbox "Spell error"
    | Application.DisplayAlerts=False
    |
    | End Sub
    |
    | TIA
    |
    | David
    |
    |
    | --
    | davidm
    | ------------------------------------------------------------------------
    | davidm's Profile:
    http://www.excelforum.com/member.php...o&userid=20645
    | View this thread: http://www.excelforum.com/showthread...hreadid=478828
    |



  3. #3
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    315
    Thanks Jim, you've made my day.

    David

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1