Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call subs from another wkbk?
Hi call,
Any guru can tell me if I can call a sub in one workbook from anothe workbook? If so, how? Many thanks. Huyeot -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call subs from another wkbk?
As suggested by John Walkenbach in his book, there are 2 option
available to you :- 1. use the run method of the application object like so :- application.run "full path name including the book name and the su procedure name that you are trying to execute - all in double quote with the book name in single quotes within the double quotes" as show below :- application.run "'c:\myfolder\myfile.xls'!myMacro" This does not require for you to establish a reference to the referre workbook. 2. Establish a reference to the desired workbook usin Tools|References| and then browsing to find the desired workbook. Th referred workbook doesn't need to be open for you to be able to use sub in that workbook. Once the reference has been established say to procedure called "myMacro", you can call the same by the followin statement :- call myMacro or simply myMacro Hope this helps! Best regards Deepak Agarwa -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call subs from another wkbk?
I know that i am not the one that posted the question, but i too wante
something similar. i tried both options and they both opened the fil that contained the macro that was supposed to be run. is it possibl to run a macro without opening the containing workbook -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call subs from another wkbk?
What is your ultimate goal? That the user doesn't see the new workbook on the
screen? If so, turn of screenupdating. On Tue, 31 Aug 2004 21:50:21 -0500, ForSale wrote: I know that i am not the one that posted the question, but i too wanted something similar. i tried both options and they both opened the file that contained the macro that was supposed to be run. is it possible to run a macro without opening the containing workbook? --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call subs from another wkbk?
the short answer is no. The workbook has to be open to run the macro.
Myrna offers a workaround for not making it obvious that it is open. -- Regards, Tom Ogilvy "ForSale " wrote in message ... I know that i am not the one that posted the question, but i too wanted something similar. i tried both options and they both opened the file that contained the macro that was supposed to be run. is it possible to run a macro without opening the containing workbook? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I call VBA subs from different spreadsheet from code behind form? | Excel Discussion (Misc queries) | |||
Call Center Management: How to calculate 'cost per call' | Excel Discussion (Misc queries) | |||
Stringing Subs | Excel Programming | |||
calling subs | Excel Programming | |||
Call VBA-Subs From Old XLM-Macros | Excel Programming |