Calling another macro?

C

Charlotte E.

Hi,


what's the diffrence between these two ways of calling another macro from
within a macro?

Call OtherMacro
Application.Run "OtherMacro"


Thanks,
 
B

Bob Phillips

Application.Run would normally be used to call procedures with variables,
that is store the macro name in a variable as you process, or in another
workbook.

If the macro is in the same workbook, Call is far more efficient.

You could even use Call if the macro is in another workbook, if you set a
reference (Tools>References) to the other workbook in the calling workbook.
 
C

Charlotte E.

Hmmmm.....


I use 'Application.Run' because it is apparrently the only way to run macros
in imported modules!

Or is it?

Is there any way to run macros in imported modules with 'Call'?


Thanks,
 
N

Nigel

If you have imported a module then it is part of the current workbook and is
callable. If you are running code to import using VBE extensibility then
probably not.

--

Regards,
Nigel
(e-mail address removed)
 
B

Bob Phillips

That would be if you try and call that procedure directly, you would get a
compile error. IF you created a macro in another module that called the
macro that gets imported, and call that from within the importing routine,
no need for Application.Run.
 
C

Charlotte E.

Heh, heh - clever way to get around this lack of re-compiling option :)

But to me it tends to be a little too much calling back and forward - I'll
still stick to 'Application.Run', which gives a more direct approch...

Let's hope that MS will allow re-compiling in future releases...

Thanks for all your answers :)
 
W

ward376

Let's hope that MS will allow re-compiling in future releases...

Probably not going to be many more future releases of vba... vb is
already gone... dotnet will be the future.

Cliff Edwards
 
W

ward376

Gone wasn't a good word to use there in reference to VB4,5,6 (not
VBA)... unsupported and unavailable new from the manufacturer.

They already released an Office without VBA for Mac.

Cliff Edwards
 
B

Bob Phillips

They (they being MS who are responsible for VBA) didn't, that was a decision
by Apple Inc. And as it happens, they (Apple in this case) have seen the
error of their ways and are bringing it back in the next release.
 
W

ward376

So how many more versions of Office do you think we'll get with VBA as
we know it today? I don't want it to go away - it just seems like
things are pointing that way.

Cliff
 
B

Bob Phillips

It will definitely be in the next one, most likely in the one after that. It
will work in many beyond that, but I wouldn't like to venture a guess at how
many?
 

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