Hi
I am trying to use vb.net to create apell check add in to ArcMap 10. I have finished code, but do not know why it does not works. need urgent help
here is my code:
Public Sub SpellCheck()
Dim pDoc As IMxDocument
pDoc = My.ArcMap.Docum ent
Dim pGC As IGraphicsContai nerSelect
If pDoc.ActiveView Is pDoc.PageLayout Then
pGC = pDoc.PageLayout
Else
pGC = pDoc.FocusMap
End If
Dim pTE As ITextElement
pTE = pGC.SelectedEle ment(0)
Dim sz As String
sz = pTE.Text
Dim wdApp As Microsoft.Offic e.Interop.Word. Application
Dim wdDoc As Microsoft.Offic e.Interop.Word. Document
wdApp = New Microsoft.Offic e.Interop.Word. Application
wdDoc = wdApp.Documents .Add
wdApp.Selection .Text = sz
wdApp.Dialogs(w dDialogToolsSpe llingAndGrammar ).Show()
' if the Cancel button is clicked, there will be one character
If Len(wdApp.Selec tion.Text) > 1 Then
pTE.Text = wdApp.Selection .Text
Else
wdApp.Quit()
wdApp = Nothing
Exit Sub
End If
wdDoc.Close(wdD oNotSaveChanges )
wdApp.Quit()
wdApp = Nothing
pDoc.ActiveView .Refresh()
End Sub
Thanks a lot!!!!!
I am trying to use vb.net to create apell check add in to ArcMap 10. I have finished code, but do not know why it does not works. need urgent help
here is my code:
Public Sub SpellCheck()
Dim pDoc As IMxDocument
pDoc = My.ArcMap.Docum ent
Dim pGC As IGraphicsContai nerSelect
If pDoc.ActiveView Is pDoc.PageLayout Then
pGC = pDoc.PageLayout
Else
pGC = pDoc.FocusMap
End If
Dim pTE As ITextElement
pTE = pGC.SelectedEle ment(0)
Dim sz As String
sz = pTE.Text
Dim wdApp As Microsoft.Offic e.Interop.Word. Application
Dim wdDoc As Microsoft.Offic e.Interop.Word. Document
wdApp = New Microsoft.Offic e.Interop.Word. Application
wdDoc = wdApp.Documents .Add
wdApp.Selection .Text = sz
wdApp.Dialogs(w dDialogToolsSpe llingAndGrammar ).Show()
' if the Cancel button is clicked, there will be one character
If Len(wdApp.Selec tion.Text) > 1 Then
pTE.Text = wdApp.Selection .Text
Else
wdApp.Quit()
wdApp = Nothing
Exit Sub
End If
wdDoc.Close(wdD oNotSaveChanges )
wdApp.Quit()
wdApp = Nothing
pDoc.ActiveView .Refresh()
End Sub
Thanks a lot!!!!!
Comment