View Single Post
 
Old 07-07-2016, 12:11 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit 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