Run Time Error = 432

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
 
D

Dirk Goldgar

iholder said:
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

I think you need to include the file extension -- presumably ".doc" --
in your call to GetObject. Try this:

Set objWord = GetObject("MergeLetter.doc", "Word.Document")

Include the full path if necessary.
 
D

Dirk Goldgar

iholder said:
I try including the extension ".doc" and alson the path directory.

The code worked for me (using a .doc file of my own, of course). Are
you sure you specified a full, correct, and complete path to the file,
including the correct filename and extension?
 
I

iholder

This is the full path:
Dim strDocName As String
'Authorized_Parking on 'Dot2811vf
strDocName = "Authorized_Parking on 'Dot2811vf'G:\Copy of Highway Travel
Permit\Highway Permit Demo\MergeLetter.doc"
Set objWord = GetObject(strDocName, "Word.Document")

It is a network drive. When I include the path I get the following error

Run-time error -2147467259(80004005)
Automation error
Unspecific error

Without the path the erorr is:
Run-time Error 432

Filename or classname not found during Automation operation.

Please note the database reside in the same directory as "MergeLetter.doc"

This is very frustating problem. The Filename name is correct. Could it be
a ojbect class problem?

Your help is greatly appreciation. I have been stuck on this problem for
one week now.
 
D

Dirk Goldgar

iholder said:
This is the full path:
Dim strDocName As String
'Authorized_Parking on 'Dot2811vf
strDocName = "Authorized_Parking on 'Dot2811vf'G:\Copy of Highway
Travel Permit\Highway Permit Demo\MergeLetter.doc"
Set objWord = GetObject(strDocName, "Word.Document")

It is a network drive. When I include the path I get the following
error

Run-time error -2147467259(80004005)
Automation error
Unspecific error

Without the path the erorr is:
Run-time Error 432

Filename or classname not found during Automation operation.

That path, specifically the drive specification part of it, doesn't look
valid to me:

Authorized_Parking on 'Dot2811vf'G:\
Please note the database reside in the same directory as
"MergeLetter.doc"

That wouldn't necessarily mean that the directory in question is the
current directory as far as Windows is concerned, so I wouldn't expect
it to find the file without specifying the path. However, you can get
the path string for the current project, so let's try using that to
locate your file. Try this code:

Dim strDocName As String

strDocName = CurrentProject.Path & "\MergeLetter.doc"
Set objWord = GetObject(strDocName, "Word.Document")
 
I

iholder

Thank you Dirk,

That solve path filename problem.

I still have some other code problems. Contact you at a later date.

Thank you for your assistance.

Ileana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top