Subj: Connectivity to Word 97 Section: Programming Issues To: ITT1, 100651,3512 Wednesday, January 27, 1999 1:59:10 AM From: Calvin G. Smith, 102226,2127 #726225 Hi Lee! >>> For some time I've been using the following code to connect to Word 95 to fill in data elements at bookmark points in a template from VB 4.0. Unfortunately this doesn't work in Word 97 for some reason, at least the .EditGoto command doesn't seem to work although it doesn't throw out any errors...Can anyone tell me how to do exactly the same thing in Word '97, preferably using VBA code as opposed to Word Basic, as VBA is the standard now and is less likely to be changed with every upgrade of Word. <<< I haven't used VB 4.0 in a couple of years, so I don't remember the environment off the top of my head. And, I'm assuming that you are trying to call your code from VB 4.0 (32-Bit). In VB 5.0, you have to reference the MS Word v8.0 Object Library first. After that, the following code will get the job done... Calvin Smith - Sr. Visual Basic/MS Access Consultant ******************************************************** WEB: http://www.CalvinSmithSoftware.com/ ******************************************************** Private Sub cmdWordBookMark_Click() '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Author: Calvin Smith 'Environment: MS VB/VBA (32-bit) 'WEB: http://www.CalvinSmithSoftware.com/ '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' '*** Reminder to reference the *** '*** MS Word Object Library *** '*** prior to calling this sub-proc. *** ' On Error GoTo cmdWordBookMark_Click_Err Static WordObj As Word.Application Set WordObj = Nothing Set WordObj = CreateObject("Word.Application") WordObj.Documents.Open ("C:\MyDocumentName.doc") With WordObj .Selection.GoTo What:=wdGoToBookmark, Name:="MyBookMarkName" .Selection.TypeText Text:="My WEB Address is: http://www.CalvinSmithSoftware.com/" End With WordObj.Visible = True cmdWordBookMark_Click_Exit: Exit Sub cmdWordBookMark_Click_Err: If Err Then 'Do whatever you need to here! Resume cmdWordBookMark_Click_Exit End If End Sub