Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2016, 12:11 PM
macropod's Avatar
macropod macropod is offline Run a macro on multiple docx. files Windows 7 64bit Run a macro on multiple docx. files Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The macro is a Word macro, not coded for running from Excel. To do that with the code in post #18, you'd need to set a reference to the Word object library (via Tools|References in the VBE), change:
Dim strFolder As String, strFile As String, wdDoc As Document, i As Long
to:
Dim strFolder As String, strFile As String, wdApp As New Word.Application, wdDoc As Word.Document, i As Long
change:
Set wdDoc = Documents.Open
to:
Set wdDoc = wdApp.Documents.Open
and change:
Set wdDoc = Nothing
to:
Set wdApp = Nothing: Set wdDoc = Nothing

To suppress link alerts, you might try inserting:
wdApp.DisplayAlerts = wdAlertsNone


before:
While strFile <> ""
and inserting:
wdApp.DisplayAlerts = wdAlertsAll
before:
Set wdApp = Nothing: Set wdDoc = Nothing

That said, it's not at all clear why you'd want to do this from Excel.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
multiple files



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open Docx files? mond_bees Word 12 08-29-2012 03:32 AM
Run a macro on multiple docx. files convert multiple csv files to multiple excel files mit Excel 1 06-14-2011 10:15 AM
Run a macro on multiple docx. files looking for macro for multiple files bolk Word 3 05-03-2011 05:46 AM
Run a macro on multiple docx. files macro to pull data from multiple files psrs0810 Excel 2 10-25-2010 01:49 PM
Icon for docx files Jazz43 Word 2 10-20-2009 08:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft