Discussion Locked

Access to Word spell check?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I would very much like to utilise a user's Word spell checker through my online (Webspeed) application. The application is on an intranet and all users are on NT. I know it's possible (ActiveX ?), but I don't know where to start. Could someone please point me in the right direction?

3 replies

by andrew

If you'd like to go the ActiveX route, here's some code for the OCX:

Option Explicit
Private mText As String
Private mCorrectedText As String

Public Property Let TextToCheck(sText As String)
mText = sText
End Property

Public Property Get CorrectedText() As String
CorrectedText = mCorrectedText
End Property

Public Sub SpellCheck()
Dim oDocument As Word.Document

Set oDocument = New Word.Document
oDocument.Content.InsertAfter mText
oDocument.CheckSpelling
mCorrectedText = oDocument.Content
Set oDocument = Nothing
End Sub

(You'll need to set a reference to the Microsoft Word 9.0 Object Library)

To use the OCX, instantiate it on your page (use the OBJECT tag), set the TextToCheck property, call the SpellCheck() method, then read the CorrectedText property.

If you prefer, you can recode it to do everything with a single function call.

Hope this helps.

This discussion is closed to new replies.