|
Products:
ArcView: VBA
Platforms: WindowsRequires: Microsoft Word object libraryMinimum ArcGIS Release: 9.0 |
Public Sub SpellCheck()
Dim pDoc As IMxDocument
Set pDoc = ThisDocument
Dim pGC As IGraphicsContainerSelect
If pDoc.ActiveView Is pDoc.PageLayout Then
Set pGC = pDoc.PageLayout
Else
Set pGC = pDoc.FocusMap
End If
Dim pTE As ITextElement
'Hard coded, check the first selected element
Set pTE = pGC.SelectedElement(0)
Dim sz As String
sz = pTE.Text
Dim wdApp As Word.Application
Dim wdDoc As Document
Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Add
wdApp.Selection.Text = sz
wdApp.Dialogs(wdDialogToolsSpellingAndGrammar).Show
' if the Cancel button is clicked, there will be one character
If Len(wdApp.Selection.Text) > 1 Then
pTE.Text = wdApp.Selection.Text
Else
wdApp.Quit
Set wdApp = Nothing
Exit Sub
End If
wdDoc.Close wdDoNotSaveChanges
wdApp.Quit
Set wdApp = Nothing
pDoc.ActiveView.Refresh
End Sub