Thread: [Solved] Word GoTo From Excel
View Single Post
 
Old 12-04-2012, 12:34 PM
mata30s mata30s is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Nov 2012
Posts: 13
mata30s is on a distinguished road
Default Word GoTo From Excel

Hi all,

I am wondering how to go to a bookmark in Word when its macro is ran from Excel. This is what I have in Excel at the moment:

Code:
 
    Dim wrdApp As Word.Application
    Dim wrdDoc As Word.Document
    Dim i As Integer
    Set wrdApp = CreateObject("Word.Application")
    wrdApp.Visible = True
    Set wrdDoc = wrdApp.Documents.Open(directory)    
 
    With wrdDoc
        
     If .Bookmarks.Exists("g") Then
            
           MsgBox "yes"
           wrdDoc.GoTo What:=wdGoToBookmark, Name:="g"
                    
     Else
           MsgBox "Not Found"
     End If
It all works, except the Word document does not go to the bookmark. After this I am hoping to expand on the code (such as adding Word Tables from the Excel code). Input appreciated.

Thank you,

Matt
Reply With Quote