Hi All,
I have a really big problem. I tried to have a spell check on my program. The code as following. It works fine on window 98 and 2000, but when I run it on window 95, It pops up "Run-time error '429': Active component can't create object" error message and close out everything. Can't everyone tell me how to fix?
Dim oWord As Word.Application
Dim oTmpDoc As Word.Document
Dim lOrigTop As Long
' Create a Word document object...
Set oWord = New Word.Application
Set oTmpDoc = oWord.Documents.Add
' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000
Dim Index As Integer
Index = 1
' Assign the text to the document and check spelling...
For Index = 1 To 5
With oTmpDoc
.Content.Text = txtEEComment(Index)
.Activate
.CheckSpelling
End With
txtEEComment(Index).Text = Left(oTmpDoc.Content.Text, Len(oTmpDoc.Content.Text) - 1)
Next Index
' Close the document and exit Word...
oTmpDoc.Saved = True
oTmpDoc.Close
Set oTmpDoc = Nothing
oWord.Top = lOrigTop
oWord.WindowState = 2
oWord.Quit
Set oWord = Nothing
Set oTmpDoc = Nothing
MsgBox "Spell Check is complete", vbInformation + vbOKOnly
I have a really big problem. I tried to have a spell check on my program. The code as following. It works fine on window 98 and 2000, but when I run it on window 95, It pops up "Run-time error '429': Active component can't create object" error message and close out everything. Can't everyone tell me how to fix?
Dim oWord As Word.Application
Dim oTmpDoc As Word.Document
Dim lOrigTop As Long
' Create a Word document object...
Set oWord = New Word.Application
Set oTmpDoc = oWord.Documents.Add
' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000
Dim Index As Integer
Index = 1
' Assign the text to the document and check spelling...
For Index = 1 To 5
With oTmpDoc
.Content.Text = txtEEComment(Index)
.Activate
.CheckSpelling
End With
txtEEComment(Index).Text = Left(oTmpDoc.Content.Text, Len(oTmpDoc.Content.Text) - 1)
Next Index
' Close the document and exit Word...
oTmpDoc.Saved = True
oTmpDoc.Close
Set oTmpDoc = Nothing
oWord.Top = lOrigTop
oWord.WindowState = 2
oWord.Quit
Set oWord = Nothing
Set oTmpDoc = Nothing
MsgBox "Spell Check is complete", vbInformation + vbOKOnly