Avatar of ramramcat
ramramcat
Flag for United States of America asked on

vfp-9 ole word automation error with word 2010/acrobat x

Hi:
I have a VFP app that uses OLE word automation to merge data and create/print documents. It has worked for years with WIN-XP and Office-2003 with Acrobat Standard-6.

We are now upgrading to Win-7 and Office-2010 with Acrobat Standard-X (10). Even after many internet searches and changes to Word settings, etc., my program will not run and returns error #1429. It keeps saying 'unable to run the specified macro', which is Adobe PDFMaker. yet the macro is listed in the Word Add-Ins and everything looks OK. I have also checked "enable ALL" macros in Word AND downgraded Office-2010 to the 32bit version.

Here is the code:

  oWord = CreateObject("Word.Application")
 
     WITH oWord
      .Run("AdobePDFMaker.AutoExec.Main")
      .Documents.Open((M_Doc))                                    && Open Copy of Master
      .Documents((M_Doc)).Activate
      .Documents((M_Doc)).MailMerge.Execute                && Run the merge
      .Documents((M_Doc)).Close                                    && Close Copy of Master
      .ActiveDocument.SaveAs(sys(5)+ALLTRIM(M_NewLoc)+ALLTRIM(M_NewName))      && Save new Document
 
      .Visible = .T.                  && View for editing/printing/re-saving/closing
      .Activate()
          
      ENDWITH
        
  RELEASE oWord

Any help would be greatly appreciated - really in a bind here.

Thanks.

Cathie
NYC
FoxProMicrosoft WordAdobe Acrobat

Avatar of undefined
Last Comment
ramramcat

8/22/2022 - Mon
Pavel Celba

I suppose the error is reported on the  ".Run( ... )" line.

How the Word macro uses Adobe Acrobat? I suppose via OLE automation. Then you have to use Adobe Acrobat Professional because the Standard version does not support OLE automation.
ramramcat

ASKER
Hi,
I downloaded and installed Acrobat-XI Professional (was not able to get a trial download of Acrobat-X Pro), but still am unable to run the above code; .

Is there a way to create mail-merge letters programmatically without referencing PDFMaker? This was written a very long time ago and I don't remember.

Thanks.
ramramcat

ASKER
FYI, it did not work to asterisk-out the  ".Run( ... )" line.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Pavel Celba

What line of code reports the error 1429?

You should also check if appropriate Word add-on is installed. Look e.g. here: http://helpx.adobe.com/acrobat/using/creating-pdfs-pdfmaker-windows.html

If everything fails then remember you don't need Acrobat to create PDF output. You may use almost any PDF printer driver, e.g. http://www.pdfforge.org/pdfcreator

And finally you should be able to save the Word document as PDF directly:
http://www.robvanderwoude.com/vbstech_automation_word.php
http://msdn.microsoft.com/en-us/library/office/ff839952%28v=office.15%29.aspx

Mailmerge from FoxPro was described many times:
http://www.tek-tips.com/viewthread.cfm?qid=1500523
http://www.tomorrowssolutionsllc.com/Conference%20Sessions/Automating%20Microsoft%20Word.pdf

Tamar's code samples and other papers are available here: http://www.tomorrowssolutionsllc.com/publications/conferencepapers
ramramcat

ASKER
Sorry to abandon this question. Our client does not want to invest in changing their (old) VFP program to work with Win7 and is keeping the program on a Win-XP PC for now.

I'm not sure what to do with the question and points.

Thanks.
ASKER CERTIFIED SOLUTION
Pavel Celba

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ramramcat

ASKER
We'll most likely revisit this issue in the future. Thanks for your help.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.