Calling Excel macro from Word 2000

C

Chad Knudson

I've got a Word document that creates a new Excel file based on an Excel
template. After the Excel file is created, I need to make a single macro
call into it that passes parameters to enable me to populate the Excel file
with information from the Word document.

Where:

wb is my new Excel workbook
strTemplate is the full path and filename of the Excel template file
SpecialHanding is the name of the macro that I want to run in the modCustom
module contained in the Excel template file
doc is the Word document from which the Excel template needs to extract
information

wb.Application.AddIns.Add strTemplate, False
wb.RunAutoMacros xlAutoOpen
wb.Application.Run "SpecialHandling", doc, bSuccess,
bRequiresPostProcessing

This works fine in Word 2003/Excel 2003. But when I try to do the same
thing in Word 2000/Excel 2000 I get a runtime error 1004 The macro
'SpecialHandling' cannot be found.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top