Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How to suppress MS Word window in spell check script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47879
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to suppress MS Word window in spell check script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 How to suppress MS Word window in spell check script - 6/4/2007 6:43:38 AM   
  aCkRiTe

 

Posts: 1
Score: 0
Joined: 6/4/2007
Status: offline
Ok so I'll admit, I dont know vbs, but have a little background in some other languages, so I have a little understanding in scripting. Below is a spell check(with MS Word) script that I found on the net the other day. I made a few changes to it and now it works just like I want it to, except that it flashes/pops up MS Word for a second or two after you make the spelling changes. Is there anyway to suppress MS Word or stop it from flashing at all? Thanks for any help on this....  How the script works:-copy word or set of words to the clipboard-run script-make changes with MS Word spell checker -then the correct spellings of the word(s) are placed back to the clipboard 
      



 
 
Post #: 1
 
 RE: How to suppress MS Word window in spell check script - 6/5/2007 8:31:19 AM   
  BPisMe

 

Posts: 5
Score: 0
Joined: 1/30/2006
Status: offline
I have this script that I found on the Net.  I hope it's OK to Post it

'BEGIN BEGIN BEGIN

' SpellCheck.vbs - Spellcheck contents of Windows clipboard.
' © Bill James - wgjames@mvps.org - 31 Mar 2003
' Requires Microsoft Word 97 or higher.  To use, copy text to be spellchecked
' then click on the script or a shortcut to the script.  After spellchecking is
' complete you can paste any corrections back to the original document.
' Hint:  Drag a shortcut from the script to the QuickLaunch bar for easy access.


WScript.Echo(SpellCheck())

Function SpellCheck()
'compatibility check
On Error Resume Next
Set oWord = CreateObject("Word.Application")
If Err Then
   SpellCheck = "Your system does not support Spell Check." & vbcrlf & _
                vbcrlf & "You must have Microsoft Word 97 or higher " & _
                "installed to enable this feature."
   Exit Function
End If
On Error GoTo 0
With oWord
   .Visible = false
   Set spellDoc = .Documents.Add
   'trap errors for empty or invalid clipboard contents
   On Error Resume Next
   .Selection.Paste
   If Err Then
     spellDoc.Close
     .Quit
     SpellCheck = "Unable to spell check current clipboard contents." & _
                  vbcrlf & vbcrlf & "Highlight text selection to spell " & _
                  "check, use Ctrl + C" & vbcrlf & "to copy it to " & _
                  "clipboard, then click the Spell Check button."
     Exit Function
   End If
   On Error GoTo 0
   strIn = spellDoc.Content.Text
   spellDoc.CheckSpelling()
'   spellDoc.CheckGrammar()
   strOut = spellDoc.Content.Text
   If strIn = strOut Then
     results = "No spelling corrections made."
   Else
     results = "Spelling corrections copied to clipboard."
   End If
   .Selection.WholeStory
   .Selection.Copy
   spellDoc.Close False
   .Quit True
End With
SpellCheck = results
End Function

'END END END

(in reply to aCkRiTe)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to suppress MS Word window in spell check script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts