ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Word from Excel VBA (https://www.excelbanter.com/excel-programming/348049-run-word-excel-vba.html)

achidsey

Run Word from Excel VBA
 

Excel Experts,

I would like to create code in an Excel VBA module that will run a Word
macro I have saved in a word document.

If the file containing the Word macro is "C:\netcap macros.doc", and the
Word macro is named "Sub PrintSLKFiles", what Excel VBA code would run this
macro.

Thanks in advance,

Alan
--
achidsey

Kaak[_51_]

Run Word from Excel VBA
 

Sub Test()

Dim WordApp As Object

Set WordApp = CreateObject("Word.Application")

LetterTemplate = "C:\TestDoc.doc"

With WordApp

.Documents.Open LetterTemplate
.Visible = True
.Run ("Macro1")

End With

WordApp.Quit

Set WordApp = Nothing

End Su

--
Kaa
-----------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...nfo&userid=751
View this thread: http://www.excelforum.com/showthread.php?threadid=49324



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com