A
Ansar_Mehmood
I am ussing spell check of word 2002 in our VB project. Its works fine when
running first time but 2nd time display a error message that error in your
'normal.dot' file, please give me solution on '(e-mail address removed)' or
'(e-mail address removed)'
my codes are
Private Sub Command1_Click()
Dim oWord As Object
Dim oTmpDoc As Object
Dim lOrigTop As Long
' Create a Word document object...
Set oWord = CreateObject("Word.Application")
Set oTmpDoc = oWord.Documents.Add
oWord.Visible = True
' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000
' copy the contents of the text box to the clipboard
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Clipboard.Clear
Clipboard.SetText Text1.SelText
' Assign the text to the document and check spelling...
With oTmpDoc
.Content.Paste
.Activate
.CheckSpelling
' After user has made changes, use the clipboard to
' transfer the contents back to the text box
.Content.Copy
Text1.Text = Clipboard.GetText(vbCFText)
' Close the document and exit Word...
.Saved = True
.Close
End With
Set oTmpDoc = Nothing
oWord.Top = lOrigTop
oWord.quit
Set oWord = Nothing
End Sub
running first time but 2nd time display a error message that error in your
'normal.dot' file, please give me solution on '(e-mail address removed)' or
'(e-mail address removed)'
my codes are
Private Sub Command1_Click()
Dim oWord As Object
Dim oTmpDoc As Object
Dim lOrigTop As Long
' Create a Word document object...
Set oWord = CreateObject("Word.Application")
Set oTmpDoc = oWord.Documents.Add
oWord.Visible = True
' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000
' copy the contents of the text box to the clipboard
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Clipboard.Clear
Clipboard.SetText Text1.SelText
' Assign the text to the document and check spelling...
With oTmpDoc
.Content.Paste
.Activate
.CheckSpelling
' After user has made changes, use the clipboard to
' transfer the contents back to the text box
.Content.Copy
Text1.Text = Clipboard.GetText(vbCFText)
' Close the document and exit Word...
.Saved = True
.Close
End With
Set oTmpDoc = Nothing
oWord.Top = lOrigTop
oWord.quit
Set oWord = Nothing
End Sub