Using Word.Application with Option Strick On

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • active

    #1

    Using Word.Application with Option Strick On

    How do you do things like the following with

    Option Strict On

    Dim ColSuggestions As Word.SpellingSu ggestions

    Dim WordApp As Object = New Word.Applicatio n

    Dim WordDoc As New Word.Document

    WordDoc = WordApp.Documen ts.Add(Template :="Normal.dot ", NewTemplate:=Fa lse)

    ....snip

    WordDoc.Range.T ext = someText

    .....snip

    colSuggestions = WordApp.GetSpel lingSuggestions (colSpellErrors .Item(1).Text)



    Thanks for any suggestions




  • Patrice

    #2
    Re: Using Word.Applicatio n with Option Strick On

    Any reason for using strong typing for WordDoc but not for WordApp ?

    Else explain a bit what is the problem you have...


    " active" <activeNOSPAM @a-znet.coma écrit dans le message de news:
    %23ThLlenWHHA.4 880@TK2MSFTNGP0 5.phx.gbl...
    How do you do things like the following with
    >
    Option Strict On
    >
    Dim ColSuggestions As Word.SpellingSu ggestions
    >
    Dim WordApp As Object = New Word.Applicatio n
    >
    Dim WordDoc As New Word.Document
    >
    WordDoc = WordApp.Documen ts.Add(Template :="Normal.dot ",
    NewTemplate:=Fa lse)
    >
    ...snip
    >
    WordDoc.Range.T ext = someText
    >
    ....snip
    >
    colSuggestions =
    WordApp.GetSpel lingSuggestions (colSpellErrors .Item(1).Text)
    >
    >
    >
    Thanks for any suggestions
    >
    >
    >
    >

    Comment

    • active

      #3
      Re: Using Word.Applicatio n with Option Strick On

      Is I don't know how a good reason?
      Guess I need a little more help

      thanks for the quick reply



      "Patrice" <http://www.chez.com/scribe/wrote in message
      news:OQnVsrnWHH A.4384@TK2MSFTN GP02.phx.gbl...
      Any reason for using strong typing for WordDoc but not for WordApp ?
      >
      Else explain a bit what is the problem you have...
      >
      >
      " active" <activeNOSPAM @a-znet.coma écrit dans le message de news:
      %23ThLlenWHHA.4 880@TK2MSFTNGP0 5.phx.gbl...
      >How do you do things like the following with
      >>
      >Option Strict On
      >>
      >Dim ColSuggestions As Word.SpellingSu ggestions
      >>
      >Dim WordApp As Object = New Word.Applicatio n
      >>
      >Dim WordDoc As New Word.Document
      >>
      >WordDoc = WordApp.Documen ts.Add(Template :="Normal.dot ",
      >NewTemplate:=F alse)
      >>
      >...snip
      >>
      >WordDoc.Range. Text = someText
      >>
      >....snip
      >>
      >colSuggestio ns =
      >WordApp.GetSpe llingSuggestion s(colSpellError s.Item(1).Text)
      >>
      >>
      >>
      >Thanks for any suggestions
      >>
      >>
      >>
      >>
      >
      >

      Comment

      • active

        #4
        Re: Using Word.Applicatio n with Option Strick On

        After I replied I looked at the syntax and noticed the difference between
        WordDoc and WordApp (because of your question) and removed the as object and
        that appears to have fixed it.

        Thanks

        "Patrice" <http://www.chez.com/scribe/wrote in message
        news:OQnVsrnWHH A.4384@TK2MSFTN GP02.phx.gbl...
        Any reason for using strong typing for WordDoc but not for WordApp ?
        >
        Else explain a bit what is the problem you have...
        >
        >
        " active" <activeNOSPAM @a-znet.coma écrit dans le message de news:
        %23ThLlenWHHA.4 880@TK2MSFTNGP0 5.phx.gbl...
        >How do you do things like the following with
        >>
        >Option Strict On
        >>
        >Dim ColSuggestions As Word.SpellingSu ggestions
        >>
        >Dim WordApp As Object = New Word.Applicatio n
        >>
        >Dim WordDoc As New Word.Document
        >>
        >WordDoc = WordApp.Documen ts.Add(Template :="Normal.dot ",
        >NewTemplate:=F alse)
        >>
        >...snip
        >>
        >WordDoc.Range. Text = someText
        >>
        >....snip
        >>
        >colSuggestio ns =
        >WordApp.GetSpe llingSuggestion s(colSpellError s.Item(1).Text)
        >>
        >>
        >>
        >Thanks for any suggestions
        >>
        >>
        >>
        >>
        >
        >

        Comment

        • aaron.kempf@gmail.com

          #5
          Re: Using Word.Applicatio n with Option Strick On

          I would reccomend using VBA instead of trying to use .NET to move VBA
          object model.

          I mean seriously here.

          Why would you possibly use .NET to push office docs?




          On Feb 27, 6:00 am, " active" <activeNOS... @a-znet.comwrote:
          How do you do things like the following with
          >
          Option Strict On
          >
          Dim ColSuggestions As Word.SpellingSu ggestions
          >
          Dim WordApp As Object = New Word.Applicatio n
          >
          Dim WordDoc As New Word.Document
          >
          WordDoc = WordApp.Documen ts.Add(Template :="Normal.dot ", NewTemplate:=Fa lse)
          >
          ...snip
          >
          WordDoc.Range.T ext = someText
          >
          ....snip
          >
          colSuggestions = WordApp.GetSpel lingSuggestions (colSpellErrors .Item(1).Text)
          >
          Thanks for any suggestions

          Comment

          Working...