Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use VB6 to load Word with bookmarks

Status
Not open for further replies.

stevenarin

Instructor
Sep 3, 2004
2
US
I know how to use the shell command in VB6 to load a specific Word document. I want to know how to have that document load and go right to a predefined bookmark within word.

Thanks
 
Add a Reference to the Microsoft Word Object Library. If you prefer not to do that you can use Late Binding.

Code:
    Dim objWord As New Word.Application
    
    objWord.Documents.Open ("C:\Bookmark1.doc")
    objWord.Selection.GoTo wdGoToBookmark, , Name:="Bookmark2"
    objWord.Visible = True
    
    Set objWord = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top