Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Run subroutines in other workbooks?

I have some code that initially opens another workbook, ie:

Set wb = Workbooks.Open ("myotherfile.xlsx")

This code opens the other workbook file and the "handle"
gets stored in the "wb" variable.

My question is, now that the workbook is open, how can
I run any of the subroutines in this other workbook???

(Assume that the "myotherfile.xlsx" file has a subroutine
named "Public Sub Foo (ByVal x as Integer)"... I would
like to call this function!)

Some have suggested that I need to use the Application.Run
method for this. Is that right?? How do I use that?

thank you


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run subroutines in other workbooks?


hello
try run [sub name] or call [sub name] withouth the []

cheers


--
D_Rennie
------------------------------------------------------------------------
D_Rennie's Profile: 1412
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=172755

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Run subroutines in other workbooks?

But the subroutine is located in a different workbook (that is also
open).....
How do I specify the other workbook??

I thought it would be something like:

Workbooks("otherbook.xlsm").Run Foo, 1

But that doesn't seem to work....



"D_Rennie" wrote in message
...

hello
try run [sub name] or call [sub name] withouth the []

cheers


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Run subroutines in other workbooks?

Application.Run "otherbook.xlsm"!Foo",1

HTH

Bob

"Robert Crandal" wrote in message
...
But the subroutine is located in a different workbook (that is also
open).....
How do I specify the other workbook??

I thought it would be something like:

Workbooks("otherbook.xlsm").Run Foo, 1

But that doesn't seem to work....



"D_Rennie" wrote in message
...

hello
try run [sub name] or call [sub name] withouth the []

cheers




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Run subroutines in other workbooks?

Sorry type there, should have been

Application.Run "otherworkbook.xlsm!Foo",1

HTH

Bob


"Robert Crandal" wrote in message
...
But the subroutine is located in a different workbook (that is also
open).....
How do I specify the other workbook??

I thought it would be something like:

Workbooks("otherbook.xlsm").Run Foo, 1

But that doesn't seem to work....



"D_Rennie" wrote in message
...

hello
try run [sub name] or call [sub name] withouth the []

cheers






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Run subroutines in other workbooks?

Don't forget that, with files that contain such characters as spaces, you'll
need to add quotes :

Application.Run "'My Other Workbook.xlsm'!Foo",1

--
If the post is helpful, please consider donating something to an animal
charity on my behalf.


"Bob Phillips" wrote:

Sorry type there, should have been

Application.Run "otherworkbook.xlsm!Foo",1

HTH

Bob


"Robert Crandal" wrote in message
...
But the subroutine is located in a different workbook (that is also
open).....
How do I specify the other workbook??

I thought it would be something like:

Workbooks("otherbook.xlsm").Run Foo, 1

But that doesn't seem to work....



"D_Rennie" wrote in message
...

hello
try run [sub name] or call [sub name] withouth the []

cheers




.

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
turn off subroutines NDBC Excel Discussion (Misc queries) 3 July 27th 09 01:23 PM
Subroutines vs. modules BrianG[_4_] Excel Programming 0 September 7th 04 10:21 PM
common subroutines - add-in Tom Ogilvy Excel Programming 2 August 25th 04 12:51 AM
Duplicate Subroutines Gary Elsner Excel Programming 8 September 14th 03 08:55 PM
Run method for subroutines Scott Excel Programming 1 August 26th 03 04:46 PM


All times are GMT +1. The time now is 09:19 AM.

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

About Us

"It's about Microsoft Excel"