Hi all,
I got this error "Microsoft word must be installed for spell Grammer Check to run!" when I do the spell check code bellow. The it does the first spell check then the error appears. Anyone familiar with this problems?
Dim strConsequense As String
Dim objWord As Object
Dim objTempDoc As Object
Dim iData As IDataObject
objWord = New Word.Application
objTempDoc = objWord.Documents.Add
'***Do loop here
Do While fSpellCheck
objWord.Visible = False
objWord.WindowState = 0
objWord.Top = -3000
Clipboard.SetDataObject(RichTextBox1.Text.Trim)
With objTempDoc
.Content.Paste()
.Activate()
.CheckSpelling()
.Content.Copy()
iData = Clipboard.GetDataObject
If iData.GetDataPresent(DataFormats.Text) Then
RichTextBox1.Text = CType(iData.GetData(DataFormats.Text), String)
End If
.Saved = True
End With
Clipboard.SetDataObject(RichTextBox2.Text)
With objTempDoc
.Content.Paste()
.Activate()
.CheckSpelling()
.Content.Copy()
iData = Clipboard.GetDataObject
If iData.GetDataPresent(DataFormats.Text) Then
RichTextBoxWorksheetConsequence.Text = CType(iData.GetData(DataFormats.Text), String)
End If
.Saved = True
End With
LoadDataNext()
If i = dv.Count - 1 Then
fSpellCheck = False
Exit Do
End If
i += 1
Loop
'***End loop
objTempDoc.Close()
objTempDoc = Nothing
objWord.Quit()
objWord = Nothing
Thanks
lehuong
I got this error "Microsoft word must be installed for spell Grammer Check to run!" when I do the spell check code bellow. The it does the first spell check then the error appears. Anyone familiar with this problems?
Dim strConsequense As String
Dim objWord As Object
Dim objTempDoc As Object
Dim iData As IDataObject
objWord = New Word.Application
objTempDoc = objWord.Documents.Add
'***Do loop here
Do While fSpellCheck
objWord.Visible = False
objWord.WindowState = 0
objWord.Top = -3000
Clipboard.SetDataObject(RichTextBox1.Text.Trim)
With objTempDoc
.Content.Paste()
.Activate()
.CheckSpelling()
.Content.Copy()
iData = Clipboard.GetDataObject
If iData.GetDataPresent(DataFormats.Text) Then
RichTextBox1.Text = CType(iData.GetData(DataFormats.Text), String)
End If
.Saved = True
End With
Clipboard.SetDataObject(RichTextBox2.Text)
With objTempDoc
.Content.Paste()
.Activate()
.CheckSpelling()
.Content.Copy()
iData = Clipboard.GetDataObject
If iData.GetDataPresent(DataFormats.Text) Then
RichTextBoxWorksheetConsequence.Text = CType(iData.GetData(DataFormats.Text), String)
End If
.Saved = True
End With
LoadDataNext()
If i = dv.Count - 1 Then
fSpellCheck = False
Exit Do
End If
i += 1
Loop
'***End loop
objTempDoc.Close()
objTempDoc = Nothing
objWord.Quit()
objWord = Nothing
Thanks
lehuong