trying to run word automation using access 2003, but I keep getting an run time error 13, type mismatch
I have a simple test function to ensure that the coding is right but I keep getting the error on the Set WordObj = CreateObject("Word.Application") line
I have a microsoft word 11 object library reference
Function FindBMark()
Dim WordObj As Word.Application
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sql As String
' Start Microsoft Word and open the document.
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open "c:\program files\compair service management\servicejob.dot"
' Find the bookmark and insert the text.
WordObj.ActiveDocument.Bookmarks("BKJobno").Select
WordObj.Selection.Text = ("Los Angeles")
' Close and save the document.
' WordObj.ActiveDocument.Close SaveChanges:=wdSaveChanges
' Quit Microsoft Word and release the object variable.
WordObj.Quit
Set WordObj = Nothing
End Function
any ideas whats going wrong here
I have a simple test function to ensure that the coding is right but I keep getting the error on the Set WordObj = CreateObject("Word.Application") line
I have a microsoft word 11 object library reference
Function FindBMark()
Dim WordObj As Word.Application
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sql As String
' Start Microsoft Word and open the document.
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open "c:\program files\compair service management\servicejob.dot"
' Find the bookmark and insert the text.
WordObj.ActiveDocument.Bookmarks("BKJobno").Select
WordObj.Selection.Text = ("Los Angeles")
' Close and save the document.
' WordObj.ActiveDocument.Close SaveChanges:=wdSaveChanges
' Quit Microsoft Word and release the object variable.
WordObj.Quit
Set WordObj = Nothing
End Function
any ideas whats going wrong here