word automation bookmarks

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

    #1

    word automation bookmarks

    With a vb.net application (vb.net 2003) , I want to make a new word doc
    where I put several bookmarks and also text in paragraphs following the
    bookmarks
    How to do?
    Thanks for any response


  • Fred Hedges

    #2
    Re: word automation bookmarks

    First, import a reference to the Word Object Library, then create an
    instance of Word:

    m_WordApplicati on = New Word.Applicatio n
    m_MainDocument =
    m_WordApplicati on.Documents.Ad d(Template:=CTy pe(m_TemplatePa th, Object))
    m_WordApplicati on.Visible = False

    Then use the documented Word Object Model to navigate and manipulate the
    document, including modifying the bookmarks collection and/or
    inserting/editing text. A word of caution however, make sure you release
    references you make to word objects, otherwise you'll find Word hanging
    around in memory even after your program has terminated.





    "andreas" <andreas@pandor a.be> wrote in message
    news:78F9g.4244 66$vD1.11523184 @phobos.telenet-ops.be...[color=blue]
    > With a vb.net application (vb.net 2003) , I want to make a new word doc
    > where I put several bookmarks and also text in paragraphs following the
    > bookmarks
    > How to do?
    > Thanks for any response
    >
    >[/color]


    Comment

    • andreas

      #3
      Re: word automation bookmarks

      Thanks but I know all these things.
      Wat I like to know are the real commands for inserting f.i. two bookmarks
      following bij text.
      Can jou write this?


      "Fred Hedges" <dontlike@spamm uch.com> wrote in message
      news:e49fj1$d4j $1$8300dec7@new s.demon.co.uk.. .[color=blue]
      > First, import a reference to the Word Object Library, then create an
      > instance of Word:
      >
      > m_WordApplicati on = New Word.Applicatio n
      > m_MainDocument =
      > m_WordApplicati on.Documents.Ad d(Template:=CTy pe(m_TemplatePa th, Object))
      > m_WordApplicati on.Visible = False
      >
      > Then use the documented Word Object Model to navigate and manipulate the
      > document, including modifying the bookmarks collection and/or
      > inserting/editing text. A word of caution however, make sure you release
      > references you make to word objects, otherwise you'll find Word hanging
      > around in memory even after your program has terminated.
      >
      >
      >
      >
      >
      > "andreas" <andreas@pandor a.be> wrote in message
      > news:78F9g.4244 66$vD1.11523184 @phobos.telenet-ops.be...[color=green]
      > > With a vb.net application (vb.net 2003) , I want to make a new word doc
      > > where I put several bookmarks and also text in paragraphs following the
      > > bookmarks
      > > How to do?
      > > Thanks for any response
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Fred Hedges

        #4
        Re: word automation bookmarks

        If you know all this, then you will know that the Word object model is well
        documented in Word itself (Word Visual Basic Reference). To add a bookmark:

        m_Document.Book marks.Add (Name:="temp", Range:=m_Select ionRange)

        Use the selection range of the text you have inserted and collapse it to the
        end before inserting the bookmark.




        "andreas" <andreas@pandor a.be> escribió en el mensaje
        news:R01ag.4271 63$VO.11304088@ phobos.telenet-ops.be...[color=blue]
        > Thanks but I know all these things.
        > Wat I like to know are the real commands for inserting f.i. two bookmarks
        > following bij text.
        > Can jou write this?
        >
        >
        > "Fred Hedges" <dontlike@spamm uch.com> wrote in message
        > news:e49fj1$d4j $1$8300dec7@new s.demon.co.uk.. .[color=green]
        >> First, import a reference to the Word Object Library, then create an
        >> instance of Word:
        >>
        >> m_WordApplicati on = New Word.Applicatio n
        >> m_MainDocument =
        >> m_WordApplicati on.Documents.Ad d(Template:=CTy pe(m_TemplatePa th, Object))
        >> m_WordApplicati on.Visible = False
        >>
        >> Then use the documented Word Object Model to navigate and manipulate the
        >> document, including modifying the bookmarks collection and/or
        >> inserting/editing text. A word of caution however, make sure you release
        >> references you make to word objects, otherwise you'll find Word hanging
        >> around in memory even after your program has terminated.
        >>
        >>
        >>
        >>
        >>
        >> "andreas" <andreas@pandor a.be> wrote in message
        >> news:78F9g.4244 66$vD1.11523184 @phobos.telenet-ops.be...[color=darkred]
        >> > With a vb.net application (vb.net 2003) , I want to make a new word doc
        >> > where I put several bookmarks and also text in paragraphs following
        >> > the
        >> > bookmarks
        >> > How to do?
        >> > Thanks for any response
        >> >
        >> >[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...