CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2001
    Location
    Israel
    Posts
    94

    How to open word doc in Line #5

    How to open word doc in Line #5

    FatMAn


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: How to open word doc in Line #5

    This code will open Word, open a file and goto line 5

    private Sub Command1_Click()

    ' declare the objects
    Dim aWord as Object
    Dim oDoc as Object
    Dim oRange as Object

    ' start Word and show it
    set aWord = CreateObject("Word.Application")
    aWord.Visible = true

    ' open a document
    set oDoc = aWord.Documents.Open("c:\somedocument.doc")

    ' goto the fifth line
    set oRange = oDoc.GoTo(wdGoToLine, wdGoToAbsolute, 5)
    oRange.Select

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured