Spellcheck Routine

Discussion of MicroSurvey CAD related issues and questions.

Moderators: Brian Sloman, Jason Poitras, James Johnston

Post Reply
Kevin B.
Posts: 36
Joined: Wed Mar 17, 2004 4:10 am
Location: Damariscotta, Maine

Spellcheck Routine

Post by Kevin B. » Wed Jul 27, 2005 6:08 am

Does anyone have a spellcheck lisp routine that works in microsurvey that they can share?
Thanks,
Kevin

Paul W
Posts: 21
Joined: Wed Jan 07, 2004 5:58 am

SPELL CHECK

Post by Paul W » Thu Aug 04, 2005 12:31 pm

Here is one found on the net
it doesn't work with 2005 at the moment
haven't had time to look at it
Good Luck

Option Explicit
Dim ssetObj As IntelliCAD.SelectionSet
Dim TxtEnt As IntelliCAD.Entity
Dim TxtObj As IntelliCAD.Text
Dim TextToCheck As String
Dim ItemCount As Integer
Dim Items As Long
Dim FirstTime As Boolean
Dim objWord As Object, objDocument As Object, strReturnValue As String

Sub SpellChk()

Dim TextFound As Boolean

TextFound = False
FirstTime = True

Set ssetObj = _
ThisWorkspace.ActiveDocument.SelectionSets.Add("ssetObj")

DoEvents
ssetObj.SelectOnScreen
DoEvents: DoEvents

If ssetObj.Count > 0 Then
ItemCount = ssetObj.Count
ThisWorkspace.ActiveDocument.Utility.Prompt (Str(ItemCount) + " objects selected")
For Items = 1 To ItemCount
Set TxtEnt = ssetObj.Item(Items)

If TxtEnt.EntityName = "Text" Then
TextFound = True
Set TxtObj = TxtEnt
If FirstTime = True Then
WordInit
FirstTime = False
End If
TxtObj.TextString = CheckSpell(TxtObj.TextString)
TxtObj.Update
DoEvents
End If
Next Items
End If
If TextFound = True Then
WordClose
MsgBox "Spell check complete", vbOKOnly, "Spell check"
Else
MsgBox "No text found. May be multi-line text or blocked text.", vbExclamation, "Text not found"
End If

End Sub

Function CheckSpell(TextValue)
Dim TextTemp As String
objDocument.Content = TextValue
objDocument.CheckSpelling
DoEvents
'Return checked text and quit Word
strReturnValue = objDocument.Content

TextTemp = strReturnValue
If Len(TextTemp) > 0 Then
TextTemp = Mid(TextTemp, 1, Len(TextTemp) - 1)
CheckSpell = TextTemp
End If

End Function

Sub WordInit()

Set objWord = CreateObject("word.Application")
objWord.WindowState = 2
objWord.Visible = False

'Create a new instance of Document
Set objDocument = objWord.Documents.Add(, , 1, True)

End Sub

Sub WordClose()

objDocument.Close False
objWord.Application.Quit True

End Sub

Glen Cameron
Posts: 1395
Joined: Fri Nov 08, 2002 12:18 pm
Location: Corbeil, Ontario, Canada
Contact:

Post by Glen Cameron » Tue Jan 13, 2009 6:09 am

FYI - MicroSurvey CAD 2009 now contains a Spell Checker command.
Glen W. Cameron, C.E.T.
City of North Bay, Ontario

Post Reply