ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling Macros oustide current module (https://www.excelbanter.com/excel-programming/280780-calling-macros-oustide-current-module.html)

Mic[_2_]

Calling Macros oustide current module
 
Here is the situation.
I have a "personal.xls" that loads a custom toolbar and
contains one of many frequently used macros.
I have another workbook with 6 frequently used macros that
is accessible publicly, department wide; we will call this
workbook "Stuff.xls".
I would like to call the macro "GL_Import" from the
toolbar that "Personal.xls" loaded.
I know that I can link the buttons directly to the macros
in the "Stuff.xls" workbook.
I could also copy the modules, forms, and such from
the"Stuff.xls" to "personal.xls" and have them linked
directly to the copy in my "personal.xls".
What I want to do is link the custom toolbar button to a
macro in "personal.xls" which opens "stuff.xls" then runs
the "GL_Import".
The answer is probably not nearly as difficult as I have
made it.
Thanks for you help in advance.
Mic


Tom Ogilvy

Calling Macros oustide current module
 
Why is it you don't want to link directly to Stuff.xls. If you do, when the
button is pushed, Stuff.xls will be opened and the macro executed. I am
not sure of the advantage of going through personal.xls to get Stuff.xls
opened, unless you want Stuff.xls to be closed immediately after running the
macro - but if it is marked read-only, having it open shouldn't cause a
problem.

--
Regards,
Tom Ogilvy



"Mic" wrote in message
...
Here is the situation.
I have a "personal.xls" that loads a custom toolbar and
contains one of many frequently used macros.
I have another workbook with 6 frequently used macros that
is accessible publicly, department wide; we will call this
workbook "Stuff.xls".
I would like to call the macro "GL_Import" from the
toolbar that "Personal.xls" loaded.
I know that I can link the buttons directly to the macros
in the "Stuff.xls" workbook.
I could also copy the modules, forms, and such from
the"Stuff.xls" to "personal.xls" and have them linked
directly to the copy in my "personal.xls".
What I want to do is link the custom toolbar button to a
macro in "personal.xls" which opens "stuff.xls" then runs
the "GL_Import".
The answer is probably not nearly as difficult as I have
made it.
Thanks for you help in advance.
Mic




No Name

Calling Macros oustide current module
 
Thank you.
As I said in my question, the answer was probably far
easier than I was making it out to be. I thought I had
tried to link to the "Stuff.xls" macro, apparently I had
not tried that before I made a few futile attempts at
writing some code to open the workbook and execute the
macro.
Again the KISS rule was overlooked.
Thanks again.
Mic

-----Original Message-----
Why is it you don't want to link directly to Stuff.xls.

If you do, when the
button is pushed, Stuff.xls will be opened and the macro

executed. I am
not sure of the advantage of going through personal.xls

to get Stuff.xls
opened, unless you want Stuff.xls to be closed

immediately after running the
macro - but if it is marked read-only, having it open

shouldn't cause a
problem.

--
Regards,
Tom Ogilvy



"Mic" wrote in message
...
Here is the situation.
I have a "personal.xls" that loads a custom toolbar and
contains one of many frequently used macros.
I have another workbook with 6 frequently used macros

that
is accessible publicly, department wide; we will call

this
workbook "Stuff.xls".
I would like to call the macro "GL_Import" from the
toolbar that "Personal.xls" loaded.
I know that I can link the buttons directly to the

macros
in the "Stuff.xls" workbook.
I could also copy the modules, forms, and such from
the"Stuff.xls" to "personal.xls" and have them linked
directly to the copy in my "personal.xls".
What I want to do is link the custom toolbar button to a
macro in "personal.xls" which opens "stuff.xls" then

runs
the "GL_Import".
The answer is probably not nearly as difficult as I have
made it.
Thanks for you help in advance.
Mic



.



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

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