Error for function mailmergeeditdatasource

K

KayteeH

We just went to Office 2003 and now our letters will no longer mail merge with the database. The error is: Error calling external object function mailmergeeditdatasource at line 84 (second to the last line in the message) in function mailmergedoc or object w_mail_merge. It still works for our Office 2000 machines so I am assuming that 2003 deals differently the mail merge. Hope someone can help!

//******************************************************************/
// Function MAILMERGEDOC for Window object W_MAIL_MERG
/
// Uses OLE with MAILMERGE to produce the documents requested
//
//******************************************************************/

// declare local variable
uint hWn
long ll_NumOfDoc,
long RetValue, CaseNumber[ ], usag
string DocumentName[ ], RunStrin
boolean MoreRecords = TRU

string oldrefnum, cpname, cpaddr1, cpaddr2, cpcity, cpstate, cpzi
string rname, rtitle, rrep, raddr1, raddr2, rcity, rstate, rzi
string eoname, eonumber, unitname, eotitle, priority, cpattoran
string rattorany, ls_nul
long refnumbe
datetime M_45days, dateX, filedat
real mone

//val = GetModuleHandle("winword.exe"
//usage = GetModuleUsage(val

SetNull(ls_null
hWnd = FindWindowA("OpusApp", ls_null

If hWnd <> 0 the
f_msg_display('I', 'Word is already executing. Exit the Word application and try again.'
Return
Els
// RUN("C:\WINWORD\WINWORD.EXE",Minimized!
End I


//Create the OLE Object -- Return an error if unsuccessfu
//Establish a connection to Word

WordOLEObject = Create OLEObjec
RetValue = WordOLEObject.ConnectToNewObject("word.application.8"
If RetValue < 0 the
f_msg_display('I', 'Could not start Microsoft Word.'
Return
End I

// Retrieve the Documents Needed to print

Open GetDocumentsToPrint

ll_NumOfDoc =
i =
// Connection = "SERVER=mdhr_sql;UID="+g_login+";PWD="+g_p

Do While MoreRecord
Fetch GetDocumentsToPrint into :CaseNumber
:DocumentName
If sqlca.sqlcode = 0 the
ll_NumOfDoc = ll_NumOfDoc +
Els
MoreRecords=FALS
End I
i=i+
Loo

Close GetDocumentsToPrint

For i = 1 to ll_NumOfDoc

DELETE from ct_doc_eur
INSERT INTO ct_doc_eur (doc_num, doc_eur, doc_case
VALUES (1, :g_eur, :CaseNumber)
COMMIT

DocumentName = "n:\letters\" + DocumentName[i

// Execute the MailMerge with WORD
WordOLEObject.wordbasic.AppMinimize(
If FileExists(DocumentName) the

WordOLEObject.wordbasic.FileOpen (DocumentName)
//WordOLEObject.visible = TRU
This is the problem line.............. WordOLEObject.wordbasic.MailMergeEditDataSource (

Open DocumentFields
 
Top