ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run a macro of another workbook (https://www.excelbanter.com/excel-programming/278174-run-macro-another-workbook.html)

Audie G. Bencosme R.

Run a macro of another workbook
 
Hello
Is it possible to open a book and make some of its macros run by code?, I
just can activate the macro editor in the macro i'm interest to run but i
can't make it run. My situation is like this: I have a workbook with a
button that opens another book which contain a macro i need to run in

order
to find a value but I can't figure how to make it run without inserting

the
code of that macro in my project code and repeat a code that is in the
workbook i just have opened.
Could someone help me, please






Audie G. Bencosme R.

Run a macro of another workbook
 
Hello everyone
I think i was misunderstood but anyway someone has just answered the same
without specifically asking for it, but thanks anyway, it's a wonderfull
grup
Audie
Here's The Answer i found and forgive my grammar


Syntax 1 and Syntax 2 assume that the macros are either in the same
WorkBook or that there is a Reference to the WorkBook containing the
macros.

To set a reference to another WorkBook : If the WorkBook containing
the macro to run is not open, open the WorkBook. Alt-F11 to access
VBE. Ctrl-R to activate Project Explorer. Select the project of the
macro that does the called. Tools References. Check the name of the
project that contains the called macros.

Syntax 1

Call MacroName ' No parameters
Call MacroName (param1, param2) ' Parameters

Syntax 2

MacroName ' No parameters
MacroName param1, param2 ' Parameters

Syntax 3 assumes that the WorkBook contaning the called macros is
open, but that there are no References to that WorkBook.

Application.Run "'FileName.xls'!MacroName"
' No parameters

Application.Run "'FileName.xls'!MacroName", param1, param2
' Parameters

----------------------------------------------------------------------------
----------------------------------

Here are some WebSites that offer info on writing VBA code (aka
creating macros) :

http://www.mvps.org/dmcritchie/excel/getstarted.htm
http://www.mvps.org/dmcritchie/excel....htm#tutorials
http://support.microsoft.com/default...content/vba101
/default.asp


HTH
Paul
----------------------------------------------------------------------------
----------------------------------
Be advised to back up your WorkBook before attempting to make changes.
----------------------------------------------------------------------------
----------------------------------

I need a macro to open multiple macros when it is ran. Any ideas ?(by
the way, Im not very experienced with macros as you might be able to
tell).


"Audie G. Bencosme R." wrote in message
...
Hello
Is it possible to open a book and make some of its macros run by code?,

I
just can activate the macro editor in the macro i'm interest to run but

i
can't make it run. My situation is like this: I have a workbook with a
button that opens another book which contain a macro i need to run in

order
to find a value but I can't figure how to make it run without inserting

the
code of that macro in my project code and repeat a code that is in the
workbook i just have opened.
Could someone help me, please









All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com