Run an Excel macro from Word

J

JillE

Hi,

Having trouble figuring out this one. Have an instance of Excel running and
want to run a macro that resides in the Excel template.

The following code works (i.e. the code within the macro is executed), but
it creates an odd anomaly in Excel 2000 where the spreadsheet doesn't display
correctly. I want to try a generic macro instead of an "auto" one to see if
it makes a difference but can't nail down the syntax.

With myExcel
ActiveWorkbook.RunAutoMacros xlAutoOpen
End With

Any help would be appreciated,

Jill
 
C

Cindy M.

Hi =?Utf-8?B?SmlsbEU=?=,

Are you looking for the Application.Run method?
Having trouble figuring out this one. Have an instance of Excel running and
want to run a macro that resides in the Excel template.

The following code works (i.e. the code within the macro is executed), but
it creates an odd anomaly in Excel 2000 where the spreadsheet doesn't display
correctly. I want to try a generic macro instead of an "auto" one to see if
it makes a difference but can't nail down the syntax.

With myExcel
ActiveWorkbook.RunAutoMacros xlAutoOpen
End With

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
J

JillE

Perhaps, but not sure of format/syntax to run an Excel macro from Word. Tried
a few formats but it's clear that my app thinks I'm referring to Word, not
Excel and returns an error message indicating that it can't find the macro.
 
C

Cindy M.

Hi =?Utf-8?B?SmlsbEU=?=,
Perhaps, but not sure of format/syntax to run an Excel macro from Word. Tried
a few formats but it's clear that my app thinks I'm referring to Word, not
Excel and returns an error message indicating that it can't find the macro.
You have to tell it which application to use. If myExcel is the variable that refers
to Excel.Application then: myExcel.Run "macroname"

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :)
 
J

JillE

Yes, I did that. I am using the following code:

Excel.Application.Run vBulkFileName & "!Module1.Message"

where vBulkFileName contains the filename

Any ideas?
 
C

Cindy M.

Hi =?Utf-8?B?SmlsbEU=?=,
Yes, I did that. I am using the following code:

Excel.Application.Run vBulkFileName & "!Module1.Message"

where vBulkFileName contains the filename

Any ideas?
At this point, I'd ask in the excel.programming newsgroup.
They'll know best what kind of thing you need to watch out
for.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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