urgent help code ArcGIS addin of spell check using vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Annie Doglas
    New Member
    • Dec 2011
    • 1

    urgent help code ArcGIS addin of spell check using vb.net

    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!!!!!
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    I'm not prety sure how ArcMap works but i can't find in your code where you actually open the doc. Perhaps something like:

    wdDoc = wdApp.Documents .Add(pDoc)

    should work.

    Comment

    Working...