| Products: ArcView: VBA Platforms: WindowsRequires: Microsoft Word object libraryMinimum ArcGIS Release: 9.0 |
Public SubSpellCheck()DimpDocAsIMxDocumentSetpDoc = ThisDocumentDimpGCAsIGraphicsContainerSelectIfpDoc.ActiveViewIspDoc.PageLayoutThen SetpGC = pDoc.PageLayoutElse SetpGC = pDoc.FocusMapEnd If DimpTEAsITextElement'Hard coded, check the first selected elementSetpTE = pGC.SelectedElement(0)DimszAs Stringsz = pTE.TextDimwdAppAsWord.ApplicationDimwdDocAsDocumentSetwdApp =NewWord.ApplicationSetwdDoc = wdApp.Documents.Add wdApp.Selection.Text = sz wdApp.Dialogs(wdDialogToolsSpellingAndGrammar).Show' if the Cancel button is clicked, there will be one characterIfLen(wdApp.Selection.Text) > 1ThenpTE.Text = wdApp.Selection.TextElsewdApp.QuitSetwdApp =Nothing Exit Sub End IfwdDoc.Close wdDoNotSaveChanges wdApp.QuitSetwdApp =NothingpDoc.ActiveView.RefreshEnd Sub