home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 May / PCWorld_2004-05_cd.bin / software / vyzkuste / spell / spell.exe / SpellCheck / Spell.vbs < prev   
Text File  |  2001-12-11  |  2KB  |  47 lines

  1. ' Spell-Checker for clipboard contents.  Requires MS Word
  2. ' Steve Yandl, October 23, 2000
  3. ' /////////////////////////////////////////////////////////////////
  4. '
  5. Dim oWD, RangeOriginal, RangeCorrected, Cnt, Status
  6. Set oWD = WScript.CreateObject("Word.Application")
  7. oWD.Visible =false
  8. oWD.Documents.Add
  9. On Error Resume Next
  10. oWD.Selection.Paste
  11. If err.number<>0 then
  12. MsgBox "Clipboard was Empty"
  13. oWD.ActiveDocument.Close wdDoNotSaveChanges
  14. oWD.Quit
  15. Set oWD=Nothing
  16. Set oWD=Nothing
  17. WScript.Quit
  18. End If
  19. '
  20. Set RangeOriginal=oWD.ActiveDocument.Range(0,oWD.Selection.End)
  21. If oWD.CheckSpelling(RangeOriginal)=False Then
  22. oWD.ActiveDocument.CheckSpelling
  23. Set RangeCorrected = oWD.ActiveDocument.Range(0,oWD.Selection.End)
  24. RangeCorrected.copy
  25. '
  26. If RangeCorrected.Words.Count>7 Then
  27. Cnt=RangeCorrected.Words.Count
  28. Status= "The text beginning with: "&_
  29. RangeCorrected.Words.Item(1)&" "&RangeCorrected.Words.Item(2)&" "&_
  30. RangeCorrected.Words.Item(3)&"....."&vbCRLF&"and ending with: ....."&_
  31. RangeCorrected.Words.Item(Cnt-2)&" "&RangeCorrected.Words.Item(Cnt-1)&_
  32. " "&RangeCorrected.Words.Item(Cnt)&vbCRLF&"has been checked "&_
  33. "and corrected version copied to the clipboard"
  34. Else
  35. Status= "<< "&RangeCorrected&" >>"&vbCRLF&"has been checked and the"&_
  36. " corrected version was copied to the clipboard"
  37. End If
  38. '
  39. Else
  40. Status= "Any words in the clipboard were all spelled correctly"
  41. End If
  42. '
  43. oWD.ActiveDocument.Close wdDoNotSaveChanges
  44. oWD.Quit
  45. Set oWD=Nothing
  46. MsgBox Status
  47.