Manejar Word desde Excel
Con esta macro podrás abrir un documento word, imprimirlo, guardarlo con otro nombre, etc. Para que funcione, debes activar la referencia a Microsoft Word (desde el menú Herramientas>Referencias del editor de macros)
Sub OpenWordDoc()
‘In order to use this code you must set a reference to the
‘Word object library by doing this. In the VB Editor click
‘Tools, References. Then search for Microsoft Word n.n Object Library
‘where n.n will depend on your version of Word.
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, “Word.Application”)
If Err.Number <> 0 Then ‘Word isn’t already running
Set wdApp = CreateObject(“Word.Application”)
End If
On Error GoTo 0
Set wdDoc = wdApp.Documents.Open(“C:tempanyolddoc.doc”)
wdApp.Visible = True
‘Aquí puedes hacer lo que quieras: imprimir, guardar, activar…
wdDoc.PrintOut
wdDoc.SaveAs “C:temphello.doc”
wdDoc.Activate
‘etc
End Sub
.