Error using Access 2007 to Open word 2007
I am currently developing an application using MsAccess 2007. As part of the development, I need to create a word document that draws tables and enter data including links to the table. When I run it with Word 2003, everything works perfectly, but when I use Word 2007 I get the following error (attached) as image. The code that generates this error is below. The code causing the error is in bold text. Any help will be appreciated.
I am currently developing an application using MsAccess 2007. As part of the development, I need to create a word document that draws tables and enter data including links to the table. When I run it with Word 2003, everything works perfectly, but when I use Word 2007 I get the following error (attached) as image. The code that generates this error is below. The code causing the error is in bold text. Any help will be appreciated.
Code:
Dim WordExport As Object
Set WordExport = CreateObject("Word.Basic")
Dim rstIMDoc As New ADODB.Recordset
Dim rstSys As New ADODB.Recordset
Dim cnn As New ADODB.Connection
Dim strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "select * from tblSys"
rstSys.Open strSQL, cnn
g_Doc_Location = rstSys!documentLoc
g_Temp_Doc = rstSys!templatepath
g_eMail_Address = rstSys!email_address
strSQL = "select * from vwIMDoc ORDER BY Reference"
Dim lCommands As Variant
Dim lCount As Integer
rstIMDoc.Open strSQL, cnn
WordExport.FileOpen (rstSys!documentpath & "\Letters\Public Report.docx")
WordExport.AppShow
WordExport.EditGoTo , Destination:="Description"
If m_String = "\" Then
m_Count = m_Count + 1
[B]WordExport.InsertObject Iconnumber:=1, FileName:=g_Doc_Location & (rstIMDoc!DocLocation), Link:=1, displayicon:=1, Tab:="1", Class:="{C184E717-402A-438F-B99E-77C2CD4091C8}", IconFileName:="C:\WINNT\System32\OLE2.DLL", Caption:=Chr$(34) + (rstIMDoc!DocName)[/B]
WordExport.nextcell
Else
WordExport.nextcell
End If
WordExport.Insert (rstIMDoc!DocName)
WordExport.nextcell
Attachments
Last edited: