Calling Word Sub from Excel

tmurj

New Member
Joined
Jun 21, 2007
Messages
23
I have built several customer sub routines in word that process various aspects of documents. I would like to be able to call the routines (custom sub) from within Excel VBA.

I am able to get the word document open from within XL... using code similar to the following. I have been unable to figure out the syntax to call the customer Word Subroutine. Any help would be greatly appreciated.

Code:
Sub XltoWord()
    Dim InputDocName As String, WApp As Word.Application, WordDoc As Word.Document

    InputDocName = "D:\Test.doc"
    
    Set WApp = Word.Application
    WApp.Documents.Open FileName:=InputDocName, ReadOnly:=False
    Set WordDoc = WApp.ActiveDocument
    
    'need to call custom word routine to process document
    '---> This is where I require help
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Code:
WApp.Run "macro name here"
should work.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top