Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I call VBA subs from different spreadsheet from code behind form? clhamilton Excel Discussion (Misc queries) 1 June 12th 09 05:47 PM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
Stringing Subs Randal W. Hozeski Excel Programming 2 May 28th 04 04:05 PM
calling subs Mike Excel Programming 4 April 8th 04 08:22 PM
Call VBA-Subs From Old XLM-Macros hglamy[_3_] Excel Programming 2 February 28th 04 09:43 PM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"