I
iholder
I received a run-time error code 432. "Filename or classname not found during
Automation Operation. Note: The filename is correct. I suspect the problem
is the class name. The error is at this line:
Set objWord = GetObject("MergeLetter", "Word.Document")
I added the following references.
Microsoft Word 10.0 Object Library
Microsoft DAO 3.6 Object
ctv OLE Control Module
Microsoft ActiveX Data Object 2.1 Library
OLE Automation
Microsoft Acess 10.0 object Library
Visual Basic For Applications
Please check the code below.
Function MergeIt()
Dim objWord As Word.Document
' Dim objWord As Object
' Set objWord = GetObject("G:\Highway Travel Permit\Highway Permit
Demo\MergeLetter", "Word.Document")
Set objWord = GetObject("MergeLetter", "Word.Document")
'
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="Highway Travel.mdb", _
LinkToSource:=True, _
Connection:="QUERY qryFormletter"
'SQLStatement:="SELECT * FROM tblCustomerProfile"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Thank you
Ileana
Automation Operation. Note: The filename is correct. I suspect the problem
is the class name. The error is at this line:
Set objWord = GetObject("MergeLetter", "Word.Document")
I added the following references.
Microsoft Word 10.0 Object Library
Microsoft DAO 3.6 Object
ctv OLE Control Module
Microsoft ActiveX Data Object 2.1 Library
OLE Automation
Microsoft Acess 10.0 object Library
Visual Basic For Applications
Please check the code below.
Function MergeIt()
Dim objWord As Word.Document
' Dim objWord As Object
' Set objWord = GetObject("G:\Highway Travel Permit\Highway Permit
Demo\MergeLetter", "Word.Document")
Set objWord = GetObject("MergeLetter", "Word.Document")
'
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="Highway Travel.mdb", _
LinkToSource:=True, _
Connection:="QUERY qryFormletter"
'SQLStatement:="SELECT * FROM tblCustomerProfile"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Thank you
Ileana