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]
|