Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21186

Hi need help with spell check?

$
0
0
Hi I added a spell check to my word program and I go to my spell check form when running the program I get an error and it want go away the error im I doing something wrong on my code heres the code.

Code:

Private Sub mnuSpelling_Click()
Dim speller As Object
Dim txt As String
Dim new_txt As String
Dim pos As Integer
       
    On Error GoTo OpenError
    Set speller = CreateObject("Word.Basic")
    On Error GoTo 0
   
    speller.FileNew
    speller.Insert RichTextBox1.Text
    speller.ToolsSpelling
    speller.EditSelectAll
    txt = speller.Selection()
    speller.FileExit 2

    If Right$(txt, 1) = vbCr Then _
        txt = Left$(txt, Len(txt) - 1)
    new_txt = ""
    pos = InStr(txt, vbCr)
    Do While pos > 0
        new_txt = new_txt & Left$(txt, pos - 1) & vbCrLf
        txt = Right$(txt, Len(txt) - pos)
        pos = InStr(txt, vbCr)
    Loop
    new_txt = new_txt & txt
   
    RichTextBox1.Text = new_txt
    Exit Sub
   
OpenError:
    MsgBox "Error" & Str$(Error.Number) & _
        " opening Word." & vbCrLf & _
        Error.Description

the error says:
This action be completed because the other application is busy and correct the problem, and it gives me 2 options
Switch---Retry buttons

onemore thing is it want go away and when I click Switch it dose noting ether or retry the same thing I have close visual basic by ctrl alt delete to get red of that error, what should I do. thanks for your time.:)

Viewing all articles
Browse latest Browse all 21186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>