calling a project module from within another project in excel 2000

L

lieven

I have 2 workbooks open : workbook1 and workbook2 each with it's own project
: project1 and project2. I can't call a sub that's in project2 from within
project1.

I tought that something like [project2].[modulename].subname should do the
job but it doesn't work.

Does anyone has a solution for this ?

thanks
 
P

Patrick Smith [MSFT]

Lieven,

Did you create a reference from the first project to the second? That
should make the second available to be called from the first.

Hope this helps,
 
S

sylvain

Hello,

I've got a similar problem, but I found a solution to your's :)
Try :

Application.Run "project2.xls!modulename.subname" [, args]

args if the sub into project2 needs arguments.
It should run, IF project1 and project2 are into THE CURRENT DIRECTORY
(this means that Excel must know the current directory).

But, does anyone knows how to make it work with a pathname, like :

Application.Run "D:\project2.xls!modulename.subname"

Simply addind "D:\" makes the call fail...

Regards, Sylvain


lieven a écrit :
 
S

sylvain

Hello,

the solution was given by Dave Peterson in another forum
(m.p.e.programming). I found it by hasard :
we need to add dummies "'" !!!!!!!!

Ex :
Application.Run "'D:\project2.xls'!modulename.subname"

Another Ex :
x = Application.Run("'YourAdd-in.xla'!YourSubName", Arg1, Arg2)


Regards,
Sylvain

sylvain a écrit :
Hello,

I've got a similar problem, but I found a solution to your's :)
Try :

Application.Run "project2.xls!modulename.subname" [, args]

args if the sub into project2 needs arguments.
It should run, IF project1 and project2 are into THE CURRENT DIRECTORY
(this means that Excel must know the current directory).

But, does anyone knows how to make it work with a pathname, like :

Application.Run "D:\project2.xls!modulename.subname"

Simply addind "D:\" makes the call fail...

Regards, Sylvain


lieven a écrit :
I have 2 workbooks open : workbook1 and workbook2 each with it's own
project : project1 and project2. I can't call a sub that's in project2
from within project1.

I tought that something like [project2].[modulename].subname should do
the job but it doesn't work.

Does anyone has a solution for this ?

thanks
 
Top