Results 1 to 7 of 7

Thread: Ms Word and Sections in VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211

    Unhappy Ms Word and Sections in VB

    Hi I have searched for this but cannot find it anywhere.

    I have opened a word file from my VB program, but ........

    I want to go straight to a given section ?

    any ideas ?

    Simon

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You can bookmark it and then go to that bookmark.
    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211
    Thanks Bruce I will give it a go tonight.

    I will scream for help if I dont understand tomorrow

    Simon

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    You don't need a bookmark.
    VB Code:
    1. Dim myRange As Word.Range
    2.     Set myRange = Application.ActiveDocument.GoTo(What:=wdGoToSection, Which:=wdGoToFirst, Count:=2, Name:="")
    3.     myRange.Select
    4.     Set myRange = Nothing
    Make sure that you either replace Application with your object variable for the application object, or replace Application.ActiveDocument with your object variable for the document object
    Frans

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211
    Thanks Frans

    I was playing with that yesterday, but could not get it to work.

    I will get it tonight though !!!!

    the

    wdgotofirst

    can I use a text name ie 'My Section Title' or must I use number


    Simon

  6. #6
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I don't think a section has a name.
    Frans

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211
    I am probably not being clear

    if I have a word document with ......................

    ahh the penny drops, I am being a bit stupid here

    I meant a heading (I was thinking of how they look in a TOC)

    Sorry

    Simon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width