How to trigger excel code from Access

S

Stephane Pelletier

Hi.

I open a Excel document from Access and I would like to call a procedure
that is already coded in the vba of the Excel file. Anybody know how to do
this ?
PS I don't want it call from the form load. I need to call it afterwards.

NOTE: I'm working with OFFICE PRO 2002.

Many thanks

Stephane
 
H

Harlan Grove

Stephane Pelletier said:
I open a Excel document from Access and I would like to call a procedure
that is already coded in the vba of the Excel file. Anybody know how to do
this ?
PS I don't want it call from the form load. I need to call it afterwards.
....

If you're using Automation in Access to open the Excel workbook, you
should have a reference to the Excel application object. If that
reference were stored as a VBA variable named xlapp in the Access
module, use a statement like

xlapp.Run "macroname"

The macro name needs to be a text string, so in double quotes, in
order to be used as an argument to the Excel Application class's Run
method.

In future, this sort of question would be best asked in either Access
or Excel programming (i.e., VBA) newsgroups rather than this one.
 
S

Stephane Pelletier

Many thanks !!!

And you are right ... I should have ask the question in the right section ...
 
Top