Mailmerge issue

M

Manish

Hi
There is macro defined in one of the word document.

one of the line is
..Destination = wdSendToNewDocument
I am getting an error saying that requested object not found.I checked
under preferences and saw that microsoft word lib is checked.

Any ideas?
P.S I am not a developer.
Thanks for all your help

manish
 
M

macropod

Hi Manish,

The problem could be caused by an error in your coding earlier on. What's the the code for rest of this sub?

Cheers
 
M

Manish

Hi Manish,

The problem could be caused by an error in your coding earlier on. What's the the code for rest of this sub?

Cheers

The thing is that the macro runs on all the machines except 2 of them.
So i am wondering if something is missing on those machines.
The rest of the code is

Public Sub MAIN()
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument (fails here)
.Execute

End With
Documents("InvoiceCoversheetmm.doc").Close
SaveChanges:=wdDoNotSaveChanges
Rem ActiveDocument.SaveAs FileName:="C:\AMAPS\InvoiceCoverSheet.doc",
FileFormat:= _
Rem wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
Rem True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
Rem False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
Rem SaveAsAOCELetter:=False
Rem Dim Counter
Rem Counter = 0
Rem While Counter < 1000000
Rem Counter = Counter + 1
Rem Wend
Rem Application.PrintOut PrintBackground = True,
FileName:="C:\AMAPS\InvoiceCoverSheet.doc"
Rem Application.Quit (wdDoNotSaveChanges)
End Sub

Thanks
manish
 
M

macropod

Hi Manish,

Well, if the code runs correctly on other machines, then there's a problem with the machines it doesn't run on - not with the code,
per se.

Have you tried running 'Office Diagnostics' (Office 2007) or 'Detect & Repair' (Office 2000 +) to correct any installation problems?
Have you also checked that the faulty PCs are fully updated with their Office installations? And, have you checked that the faulty
PCs have the same vba references set as the good ones?
 
P

Peter Jamieson

You will see this message if there is no MailMerge object in the document,
and that will happen if Word did not open the datasource.

At the moment I would say there are two strong possibilities why thiat would
happen on some machines and not others:
a. http://support.microsoft.com/kb/825765/en-us has been applied on some
machines and not others
b. Word updates are more up-to-date on some machines than others (a fairly
recent security update has altered Word's behaviour when it is opening
MailMerge documents).
 

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