Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP to doesn't launch Ms Word's mailmerge

Jay9988

Programmer
Mar 2, 2023
49
0
6
ID
Hi All,
I have an application to launch MS Word mailmerge.
It is using VFP class: mailmrge.vcx
with this command
Code:
WITH THISFORM._mailmerge
    .cAppTitle = "Kontrak Sewa"    && application name, used in Alerts 
    .nWordProc = 1                    && word processor (1 = Word 6+; 2 = CommaDelim; or user-defined (see below); default = 1)
    .nNewDoc = 2                    && is it a new doc (1 = new, 2 = existing; default = 1)
    .cdocname=mdrive+mfile
    .nTemplate = 1                    && type of main document (Word only, 1 = form letter; 2 = label; 3 = envelope; 4 = catalog; default = 1)
    .cAlias = ALIAS()                && alias of source table or view
    ACOPY(aflds, .aAutoFields)        && fill in array of field names to be used
    .MakeOutput()                    && do the merge
   ENDWITH

But, in several PCs the Word window doesn't launch. In other PCs works fine... The VFP ODBC driver has been installed in all the PCs

Is it anything related to Office version? Because I have 2 PC's, both using Word 2013. The one pc is work fine, and the other pc Word doesn't launch.

Does anyone know the problem ?

Many thanks
 
Is Word actually installed on the machines where you're having a problem? Not the Click to run or Office 365 version?

Tamar
 
Is Word actually installed on the machines where you're having a problem? Not the Click to run or Office 365 version?

Tamar
Hi Tamar,
Yes, the Word is installed, and running. But in several computers, the MS WORD cannot launched from VFP using code above. VFP ODBC Driver is also installed. I have tried in 4 computers: 2 computers is using Word 2016 and 2013, and the code is running properly. The other 2 computers using Word 2013 and 2019, the mailmerge doesn't lounched.
 
Last edited:
How about bypassing the VFP Mailmerge class and the ODBC driver? In other words, see what happens when you do this:

Code:
loWord = CREATEOBJECT("word.applicaiton")

This will not give you the solution, but it will tell you whether it is Word (or more precisely the Word Automation server) which is at fault, or the VCX or ODBC driver.
 
How about bypassing the VFP Mailmerge class and the ODBC driver? In other words, see what happens when you do this:

Code:
loWord = CREATEOBJECT("word.applicaiton")

This will not give you the solution, but it will tell you whether it is Word (or more precisely the Word Automation server) which is at fault, or the VCX or ODBC driver.
Just pointing out a minor typo in Mike's code that would give you trouble in a cut-and-paste. Should be:

Code:
loWord = CREATEOBJECT("word.application")

Tamar
 

Part and Inventory Search

Sponsor

Back
Top