Spell Check

Share actions you've created here.
Post Reply
Posts: 12
Joined: Wed Jul 06, 2011 2:16 pm

Spell Check

Post by Austin » Wed Jul 27, 2011 3:12 pm

This Action will create a MS Word Document and use that to check the spelling of the current clipboard item. This Action is far from perfect, but it does illustrate the concept of spell checking fairly well. I'm sure a better programmer than I could make this Action better...

Code: Select all

'Author: Austin James
'Date:   7/27/2011

' This works with MS Word 2007 and 2010.  It is untested on other versions of MS Word.
' MS Word is required for this to work.
' Concept modified from posts by MartinLiss at http://www.vbforums.com/archive/index.php/t-283064.html
' MS Word is a product of Microsoft Corporatioon.

Dim objWord
Dim objDoc
' Create a Word Object and hide window
Set objWord = CreateObject("Word.Application")
objWord.WindowState = 2
objWord.Visible = False
' Create a new document
Set objDoc = objWord.Documents.Add(,,1,True)
' Add current Clipboard item to document
objDoc.Content = Clipboard.Value
' Make the document visible and begin the spell check
objWord.Visible = True
' Get the spell checked text back from MS Word.  If the text is 
' correclty spelled, Then the item is duplicated on the clipboard
' unless the Replace Original Item checkbox is checked.
Clipboard.Value = Trim(Left(objDoc.Content, Len(objDoc.Content) - 1))
' Clean up
Set objDoc = Nothing
Set objWord = Nothing

Post Reply