VBScript used as Macros for documentation - Open source - Spell Check Using Word

This simple VBscript will spell check any web page you are visiting.
You can also use it to spell check text you entered in a form field before pressing the "Send" button.
It gives you al the option Spellcheck offered by Word.
The user will have the choice to Ignore, Add, Change, AutoCorrect.
This script could be used by ebay users before sending the description of their items !:)


This simple VBscript will use Word Spellchecker to correct (if needed) the text entered in a form field.
The user will have the choice to Ignore, Add, Change, AutoCorrect.
If you are a translator, by changing the code, you call call translation software to send to translation the the text entered in a form field.

Open notepad, place the code below, save the file with HTML extension (the name you wish), Open Window Explorer and double-click the file you just saved.

<HTML>
<HEAD>
<TITLE>Simple Spell Check Using Word</TITLE>
</HEAD>
<BODY>
<H3>Simple Spell Check Using Word</H3><HR>
<FORM NAME="myForm" action="" onsubmit="SpellCheckOnClick(); return false;" language="jscript">
<LABEL FOR = "TEXTAREA2check"><strong>Type the text in this area:</strong></LABEL>
<BR><TEXTAREA NAME="TEXTAREA2check" ROWS=3 COLS=60>GeoMedia Prodfessional buildc 5.00.50.55</TEXTAREA>
<br>
<INPUT TYPE="SUBMIT" NAME="BUTTONSpellCheck" VALUE="Spell check">
</FORM>
<SCRIPT LANGUAGE="VBScript"> 
Sub SpellCheckOnClick()
	if Trim(myForm.TEXTAREA2check.Value) = "" then
		myForm.TEXTAREA2check.Value =  "Please enter text here!"
	else
	Dim String2Check
	String2Check = Trim(myForm.TEXTAREA2check.Value)

            ' Create a Word document object...
               Set TheWordApp = CreateObject("Word.Application")
               Set TmpDocument = TheWordApp.Documents.Add
               
            ' Position Word off screen to avoid having document visible...
               lOrigTop = TheWordApp.Top
               TheWordApp.WindowState = 0
               TheWordApp.Top = -3000
                          
             ' Assign the text to the document and check spelling...

               With TmpDocument
                 .Activate
             ' .Content.paste if you want to paste strings from the clipboard
                 .Content.Text = String2Check
                 .CheckSpelling
               
               ' After user has made changes, get text back...  
                myForm.TEXTAREA2check.Value =  .Content.Text          
               ' Close the document and exit Word...
                .Saved = False
                .Close (0)
               End With
            
		Set TmpDocument = Nothing
		TheWordApp.Top = lOrigTop
		TheWordApp.Quit
		Set TheWordApp = Nothing

	end if
End Sub
</SCRIPT>
</BODY>
</HTML>

Example of series of VBScript Script commands and VBScript Script instructions that can be grouped as a single user VBScript command.
This code has been used with different options added.
It allows the user (for example) to spell check a selected text in an HTML form field.

Create a text file with the extension VBS.

Here is the main VBS engine:

You can launch it by creating a file with an HTML extension:

Passing variables from command line:

Command-line parameters in arguments collection:

Dim objArgs
Set objArgs = WScript.Arguments

    For I = 0 to objArgs.Count - 1
        WScript.Echo objArgs(I)
ArgumentPAssed =  objArgs(I)
    Next

For 1 command-line paramenter:

set objArgs = wscript.arguments
ArgumentPAssed = objargs(0)

Use of FileSystemObject to retrieve the file version for a .dll file:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.Echo objFSO.GetFileVersion("c:\windows\system32\scrrun.dll")

Use FileSystemObject to enumerate (in English and French) the properties of a file:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("c:\windows\system32\scrrun.dll")
Wscript.Echo "Date created: / Date de création: " & objFile.DateCreated
Wscript.Echo "Date last accessed: / Date du dernier accès: " & objFile.DateLastAccessed
Wscript.Echo "Date last modified: / Date de la dernière modification: " & objFile.DateLastModified
Wscript.Echo "Drive: / Disque: " & objFile.Drive
Wscript.Echo "Name: / Nom :" & objFile.Name
Wscript.Echo "Parent folder: / Dossier: " & objFile.ParentFolder
Wscript.Echo "Path: / Chemin d'accès: " & objFile.Path
Wscript.Echo "Short name: / Nom court: " & objFile.ShortName
Wscript.Echo "Short path: / Chemin d'accès court: " & objFile.ShortPath
Wscript.Echo "Size: /Taille: " & objFile.Size
Wscript.Echo "Type: " & objFile.Type

Search the Microsoft web site with key words as: CreateObject("Excel.Sheet"), Set ExcelSheet = Nothing, Automate Excel from an HTML Web Page Using JScript, Automate PowerPoint, OLE Programmatic Identifiers, onclick Event.

Click on the links below to join in the forum discussions, and be sure to log in as a member when posting to the forums:

Visual Basic (Microsoft): Version 5 & 6 Tek-Tips Forums - Member name: dgschnei

More on VBScript

VBA Visual Basic for Applications (Microsoft)

Become a member of the computer professional web community - Tek-Tips

Check Google Groups - Member name: dgschnei

About me and my activities since 1995 - Developing solutions that really help - No gimmicks
Participation on Google
Participation on Yahoo!

Tek-Tips Forums dgschnei
Listed since 1996 ixquick
International Services Vivísimo

platform sdk dgschnei
Cooperation on Google
About Me
Gifts Home Decoration

Return Home - Index