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!

Access VBA to run Word macro on batch list of files

Status
Not open for further replies.

SMHSleepy

Technical User
Sep 8, 2009
174
CA
Hello all,

I have a Word macro which converts a word document to pdf and copies it to a network folder. I would like to code VBA in Access which will go to a specific directory containing a bunch of Word documents and run the macro on each file before returning to the database. Can someone get me started on this? Thank you.

sleepy

*** UPDATE ***

Okay, I got it working by using fso and a for loop. However, when I run the process it leaves all the Adobe pdf's open. How can I get either my Word macro to convert to pdf without opening Adobe Acrobat, or code Access VBA to close Adobe Acrobat after each file is processed?

My line in macro for the conversion is:
doc.ExportAsFixedFormat path & strFName, wdExportFormatPDF, True, wdExportOptimizeForOnScreen, wdExportFromTo, theStart, theEnd

Any suggestions?

*** UPDATE *** LOL

All I had to do was change True to False in the above line of macro. All good now. I'll leave this here as a reminder of my stupidity...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top