Quick Search for:  in language:    
short,sweet,function,accepts,string,containin
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

CString v1.5
By Ultimatum on 7/2


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

MsSpellCheck( string ) : string

Print
Email
 

Submitted on: 4/8/1998
By: Eric Russell 
Level: Not Given
User Rating: By 105 Users
Compatibility:VB 4.0 (32-bit), VB 5.0, VB 6.0

Users have accessed this code 11943 times.
 
 
     This short and sweet function accepts a string containing text to be spell checked, checks the text for spelling using MS Word automation, and then returns the processed text as a string. The familiar MS Word spelling dialog will allow the user to perform actions such as selecting from suggested spellings, ignore, adding the word to a customized dictionary, etc.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: MsSpellCheck( string ) : string
' Description:This short and sweet funct
'     ion accepts a string containing text to 
'     be
spell checked, checks the text For spelling using MS Word automation,
and Then returns the processed text as a string. The familiar
MS Word spelling dialog will allow the user To perform actions such
as selecting from suggested spellings, ignore, adding the word To a
customized dictionary, etc.
' By: Eric Russell
'
' Inputs:String - Text to be checked for
'     spelling
'
' Returns:String - Text after modificati
'     on by user from the Word spell checking 
'     dialog.
'
' Assumes:You need to have Microsoft Wor
'     d95 or higher installed on the PC. Just 
'     place the function in a project module o
'     r the general declaration section of a f
'     orm.
'
' Side Effects:There are no known side e
'     ffects.
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=843&lngWId;=1'for details.'**************************************

' Description: This function accepts a s
'     tring containing text to be
' spell checked, checks the text for spe
'     lling using MS Word automation,
' and then returns the processed text as
'     a string. The familiar
' MS Word spelling dialog will allow the
'     user to perform actions such
' as selecting from suggested spellings,
'     ignore, adding the word to a
' customized dictionary, etc.
'Syntax: MsSpellCheck( String ) : String
'     
'Author: Eric Russell
'E-Mail: erussell@cris.com
' WEB Site: http://cris.com/~erussell/Vi
'     sualBasic
' Created: 1998-13-14
' Revised: 1998-04-03
'Compatibility: VB 5.0, VB 4.0(32bit)
' Assumptions: The user must have MS Wor
'     d95 or higher installed on
'their PC.
'References: Visual Basic For Applicatio
'     ns, Visual Basic runtime
'objects and procedures, Visual Basic ob
'     jects and procedures.
'

Function MsSpellCheck(strText As String) As String

Dim oWord As Object Dim strSelection As String Set oWord = CreateObject("Word.Basic") oWord.AppMinimize MsSpellCheck = strText oWord.FileNewDefault oWord.EditSelectAll oWord.EditCut oWord.Insert strText oWord.StartOfDocument On Error Resume Next oWord.ToolsSpelling On Error Goto 0 oWord.EditSelectAll strSelection = oWord.Selection$ If Mid(strSelection, Len(strSelection), 1) = Chr(13) Then strSelection = Mid(strSelection, 1, Len(strSelection) - 1) End If
If Len(strSelection) > 1 Then MsSpellCheck = strSelection End If
oWord.FileCloseAll 2 oWord.AppClose Set oWord = Nothing End Function


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
5/7/1999 4:51:00 AM:Steve
I got the error "ActiveX can't create 
object.  It hightlighted this 
line:
Set oWord = 
CreateObject("Word.Basic")
I made 
refrences to both msword, and msoffice. 
 Does anyone know what is causing this 
error.  If you do please email me.  
Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/26/1999 2:22:00 PM:Ray Xu
without the MS word installed, can I 
still use it?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/14/1999 9:41:00 AM:Cy
Steve,
Office 95 MSWord - Uses Word 
Basic which this code refers 
to.
Office 97 MSWord uses VBA (Visual 
Basic for Applications). Which IS 
different to Word Basic
I may be 
wrong but I would say that you are 
using MSWord from Office 97 and this 
may by why you have your 
problem.
Any one have any ideas ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/17/1999 10:56:00 AM:Jim
This is what I use with Office 97 & 
2000 and it works OK.
Public 
Function SpellCheck(SpText As 
String)
On Error GoTo 
ErrorHandler
Dim WdBasic As 
Object
Dim TmpString As String
Set 
WdBasic = CreateObject("Word.Basic")
  WdBasic.FileNew
    WdBasic.Insert 
SpText
    WdBasic.ToolsSpelling
WdBasic.editselectall
WdBasic.EditCut
    SpellCheck = 
Clipboard.GetText
    WdBasic.FileExit 
(2)
Exit Function
ErrorHandler:
End 
Function
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/29/1999 6:04:00 PM:Rasputin
HEY, MORE DUFF CODE!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/12/2000 11:22:42 AM:Ahmad Kampoori
You save my time. Keep write codes 
which are useful like spell 
check!!!
Thank you for your help.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/17/2003 3:33:49 PM:
GREAT stuff!  How could this be tweaked 
to bring in the suggested spelling, 
which would correct the 
spelling?
Thanks!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.