Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tie in with Word Dictionary

Status
Not open for further replies.

hayt

IS-IT--Management
Oct 5, 2004
132
0
0
US
Is there a way to tie a vb.net app with the ms word dictionary??? what i want to do is take in a string, and do a spell check on it. I've searched all over, but maybe i am just entering bad criteria. If anyone has any idea, code, advice, it would be appreciated

hayt
 
I'm sure I saw an article on this in a magazine, maybe a year or so ago, possibly MSDN or VSJ - check their archives.

Hope this helps.
 
This will bring up the Spell Checking dialog:

Code:
            Dim word_server As New Word.Application
            word_server.Visible = False
            Dim doc As Word.Document = _
                word_server.Documents.Add()
            Dim rng As Word.Range
            rng = doc.Range()
            rng.Text = "[b]your text to spell check[/b]"
            doc.Activate()
            doc.CheckSpelling()

            ' Copy the results back into the TextBox,
            ' trimming off trailing CR and LF characters.
            Dim chars() As Char = {CType(vbCr, Char), _
                CType(vbLf, Char)}
            [i]Control[/i].Text = doc.Range().Text.Trimchars)
You can read the full article here:
 
As a very simple example to get you started, you can use:
Code:
            ' Create invisible word application
            Dim wrd As New Word.Application
            wrd.Visible = False

            ' Create a new document & range
            Dim doc As Word.Document = wrd.Documents.Add()
            Dim rng As Word.Range = doc.Range()

            ' Set the range to the current Text and active the spellchecker
            rng.Text = TextBox1.Text
            doc.Activate()
            doc.CheckSpelling()

            ' Read the Text back in
            TextBox1.Text = doc.Range().Text

            ' Clean Up
            doc.Close(SaveChanges:=False)
            wrd.Quit()


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Guess so (at least I know I was on the right tracks!).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top