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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm attempting to use MS spell chec

Status
Not open for further replies.

Kreiss

Programmer
Joined
Oct 8, 2003
Messages
48
Location
US
I'm attempting to use MS spell checker...I've followed the instructions from but I'm getting an "Automation Error, The system can't find the path specified error." It's highlighting the : Set oWord = CreateObject("Word.Application") Any suggestions on what I'm doing wrong?

Option Explicit

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
 
You do have Word installed on your PC, don't you?
 
Code works fine on my system - supposedly nothing is wrong with the code.

But you are using late binding to invoke the Word Application, which may suggest that the path to the application cannot be resolved at run time. You may want to include a Server name while calling the Word Application
CreateObject("Word.Application", "MyServerName").

Alternatively you can use Early Binding: Set references to the appropriate MS Word Application (Project -> References -> MS Office 10.0 Library + MS Word 10.0 object Library)
Early Binding is invoked as follows:
Dim oWork AS Work.Application
Set oWork = New Work.Application


In principle, if the appropriate libraries are installed on your system (Word XP aka 2002) in this case, it should show up.

_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Thanks for the response. I have Word installed and have tried reinstalling Also, attempted late binding. Any other suggestions?

Thanks,
Kacy
 
...and have tried reinstalling... Did you succeed re-installing?? What version do you have??


...attempted late binding... Did you attempt early binding and what was the result?


_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Do you have the Norton Anti-Virus plug-in for Office docs? If so try disabling it.

Which version of Word? What was the error number?

Paul Bent
Northwind IT Systems
 
not something as simple as:-


is it??

good luck

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383
 
Word reinstalled correctly on my machine...As far as the error number and description, here is what I am getting...

Run –time error ‘-2147024893 (80070003)
Automation error
The system cannot find the path specified.


Thanks,
Kacy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top