ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A simple question (https://www.excelbanter.com/excel-programming/334287-simple-question.html)

Fausto Arinos Barbuto

A simple question
 

Hi,

I have two workbooks, "A" and "B", and both are open and contain
macros/functions. How do I call (execute), from "A", a macro in "B"?
Is that possible?

Thanks in advance for any help!

---Fausto





David Jessop

A simple question
 
Try

Sub Test()
Application.Run "B!Module1.Test"
End Sub

where you've defined a function called Test in Module1 of worksheet B.

HTH

"Fausto Arinos Barbuto" wrote:


Hi,

I have two workbooks, "A" and "B", and both are open and contain
macros/functions. How do I call (execute), from "A", a macro in "B"?
Is that possible?

Thanks in advance for any help!

---Fausto






Bob Phillips[_6_]

A simple question
 
Application.Run "'B.xls'!myMacro"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fausto Arinos Barbuto" wrote in message
...

Hi,

I have two workbooks, "A" and "B", and both are open and contain
macros/functions. How do I call (execute), from "A", a macro in "B"?
Is that possible?

Thanks in advance for any help!

---Fausto







Fausto Arinos Barbuto

A simple question
 

Worked 100% well! Thanks so much, Bob!

---Fausto


"Bob Phillips" wrote in message
...
Application.Run "'B.xls'!myMacro"

--

HTH

RP
(remove nothere from the email address if mailing direct)




Anne Troy[_2_]

A simple question
 
Like this:
Application.Run "PERSONAL.XLS!Cleanup"

*******************
~Anne Troy

www.OfficeArticles.com


"Fausto Arinos Barbuto" wrote in message
...

Hi,

I have two workbooks, "A" and "B", and both are open and contain
macros/functions. How do I call (execute), from "A", a macro in "B"?
Is that possible?

Thanks in advance for any help!

---Fausto







Fausto Arinos Barbuto

A simple question
 

"Bob Phillips" wrote in message


Application.Run "'B.xls'!myMacro"


A brief observation though: the '' around B.xls seem to be
unnecessary, as

Application.Run "B.xls!myMacro"

works fine.

---Fausto





Fausto Arinos Barbuto

A simple question
 

"Anne Troy" wrote in message

Like this:
Application.Run "PERSONAL.XLS!Cleanup"


Thanks, Anne. And if I want to be really picky, I might even call
a function/sub like this:

Application.Run "Consequences.xls!Flow.CalculatePressureDrop"

where "Flow" is the name of the module where the function/sub
"CalculatePressureDrop" resides.

Now I can integrate my workbooks properly. :-)

---Fausto





All times are GMT +1. The time now is 03:06 PM.

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