Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2009
    Thanked 0 Times in 0 Posts
    I am trying to figure out how to
    1) activate a sound when a misspelled word is detected
    2) how to change the sound file that is being accessed

    Windows Vista
    MS Office 2007

    Reason: A family friend is a touch typist and doesn't make many mistakes but because he is focusing on other documents while typing he doesn't notice his mistakes until he starts to do his proof reading and occasionally misses them there. He would like an audible notice that he mistyped something.

    Any suggestions or recommendations?


  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts
    [quote name='eettamu' post='789261' date='16-Aug-2009 17:25']I am trying to figure out how to
    1) activate a sound when a misspelled word is detected
    2) how to change the sound file that is being accessed[/quote]
    There have been threads here (Word or VBA boards) in the past about rigging up some customer event detection code triggered by a particular keystroke, such as the spacebar. I think you might have to do that, but to avoid severe disruptions, you might want to link it to the Enter key. Being interrupted more often than that would drive me crazy.

    If you enable real-time spell checking, I believe Word maintains a programmable object that catalogs spelling errors. Every time the user presses Enter, you could compare the current count of errors against a count stored at the previous Enter. You could alert when it has changed. Off the top of my head, I don't have a good idea of how to play a sound from VBA code, but there must be a way.

    In all, it sounds like a lot of moving parts.

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Melbourne, Victoria, Australia
    Thanked 295 Times in 267 Posts
    You could try code like the following to get yourself started. The problem is whether to use this tied to a keystroke event or just run every minute or so. I agree with Jefferson that being tied to the Enter key would be a reasonable granularity and this would avoid the need to run the code at all when browsing files.
    Sub RunPeriodically()
      Dim I As Integer, iNewErrors As Integer, iOldErrors As Integer
      iOldErrors = ActiveDocument.BuiltInDocumentProperties("Category")
      iNewErrors = ActiveDocument.SpellingErrors.Count - iOldErrors
      For I = 1 To iNewErrors
    	Beep	' Sound a tone for each new error.
      Next I
      'update the counter
      ActiveDocument.BuiltInDocumentProperties("Category") = ActiveDocument.SpellingErrors.Count
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Wellington, New Zealand
    Thanked 1 Time in 1 Post
    If you want something other than a beep, here is some VBA code that I use (with Windows 2000 and Word 2002) to play a wave file:

    Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Public Sub SuccessSound()
    Call sndPlaySound32("C:\Mine\Templates\Current\Sounds\success.wav", 0)
    End Sub

Posting Permissions

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