ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a Word macro from Excel problem (https://www.excelbanter.com/excel-programming/359450-running-word-macro-excel-problem.html)

PaulC

Running a Word macro from Excel problem
 

I am trying to run a Word macro from Excel. The Macro, called
DocumentSave1 is saved in the ThisDocument folder of the WrapUpTemplate
file (see code). The relevant part of the code is:

Dim wdApp as Word.Application

Set wdApp = CreateObject("word.application")

wdApp.Documents _
..Open("P:\Spreadsheet Project\WrapUp\" & WrapUpTemplate) _
..Application.Visible = True

wdApp.Activate
With wdApp

....various word coding to copy text into template (this all works
fine)

DocumentSave1

End with

I just don't know how to get it to go to the Word macro. I have tried
moving DocumentSave1 to the Modules folder, but that does not seem to
work either.

Any help with this would be very gratefully received,

Paul


--
PaulC
------------------------------------------------------------------------
PaulC's Profile: http://www.excelforum.com/member.php...fo&userid=7563
View this thread: http://www.excelforum.com/showthread...hreadid=534989


Martin

Running a Word macro from Excel problem
 
..Run "DocumentSave1"

"PaulC" wrote:


I am trying to run a Word macro from Excel. The Macro, called
DocumentSave1 is saved in the ThisDocument folder of the WrapUpTemplate
file (see code). The relevant part of the code is:

Dim wdApp as Word.Application

Set wdApp = CreateObject("word.application")

wdApp.Documents _
.Open("P:\Spreadsheet Project\WrapUp\" & WrapUpTemplate) _
.Application.Visible = True

wdApp.Activate
With wdApp

....various word coding to copy text into template (this all works
fine)

DocumentSave1

End with

I just don't know how to get it to go to the Word macro. I have tried
moving DocumentSave1 to the Modules folder, but that does not seem to
work either.

Any help with this would be very gratefully received,

Paul


--
PaulC
------------------------------------------------------------------------
PaulC's Profile: http://www.excelforum.com/member.php...fo&userid=7563
View this thread: http://www.excelforum.com/showthread...hreadid=534989



PaulC

Running a Word macro from Excel problem
 

Martin

Many thanks. I found it worked with just one period in front of Run:

..Run "DocumentSave1"

Thanks again,

Paul


--
PaulC
------------------------------------------------------------------------
PaulC's Profile: http://www.excelforum.com/member.php...fo&userid=7563
View this thread: http://www.excelforum.com/showthread...hreadid=534989



All times are GMT +1. The time now is 05:45 PM.

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