home *** CD-ROM | disk | FTP | other *** search
- ' Spell-Checker for clipboard contents. Requires MS Word
- ' Steve Yandl, October 23, 2000
- ' /////////////////////////////////////////////////////////////////
- '
- Dim oWD, RangeOriginal, RangeCorrected, Cnt, Status
- Set oWD = WScript.CreateObject("Word.Application")
- oWD.Visible =false
- oWD.Documents.Add
- On Error Resume Next
- oWD.Selection.Paste
- If err.number<>0 then
- MsgBox "Clipboard was Empty"
- oWD.ActiveDocument.Close wdDoNotSaveChanges
- oWD.Quit
- Set oWD=Nothing
- Set oWD=Nothing
- WScript.Quit
- End If
- '
- Set RangeOriginal=oWD.ActiveDocument.Range(0,oWD.Selection.End)
- If oWD.CheckSpelling(RangeOriginal)=False Then
- oWD.ActiveDocument.CheckSpelling
- Set RangeCorrected = oWD.ActiveDocument.Range(0,oWD.Selection.End)
- RangeCorrected.copy
- '
- If RangeCorrected.Words.Count>7 Then
- Cnt=RangeCorrected.Words.Count
- Status= "The text beginning with: "&_
- RangeCorrected.Words.Item(1)&" "&RangeCorrected.Words.Item(2)&" "&_
- RangeCorrected.Words.Item(3)&"....."&vbCRLF&"and ending with: ....."&_
- RangeCorrected.Words.Item(Cnt-2)&" "&RangeCorrected.Words.Item(Cnt-1)&_
- " "&RangeCorrected.Words.Item(Cnt)&vbCRLF&"has been checked "&_
- "and corrected version copied to the clipboard"
- Else
- Status= "<< "&RangeCorrected&" >>"&vbCRLF&"has been checked and the"&_
- " corrected version was copied to the clipboard"
- End If
- '
- Else
- Status= "Any words in the clipboard were all spelled correctly"
- End If
- '
- oWD.ActiveDocument.Close wdDoNotSaveChanges
- oWD.Quit
- Set oWD=Nothing
- MsgBox Status
-