Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Running a macro in another WB

Excel XP & Win XP
I have files AAA.xls and BBB.xls open.
I am running code that is in AAA.xls.
I want to run macro MyProc that is in BBB.xls.
For that I use this code:
Application.Run "BBB.xls!MyProc"
I get the error that the macro cannot be found.
I checked the file and macro names and they are right.
Is the Application line syntax not right?
Thanks for your time. Otto
PS: The 2 files reside in different folders. Could that be a problem?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Running a macro in another WB

Create a Personal.xlsb, you can choose this when you record a macro, then
place the code in a module in the Personal.xlsb and use the following

Application.Run ("Personal.xlbs!MyProc")

hth

Mark

"Otto Moehrbach" wrote:

Excel XP & Win XP
I have files AAA.xls and BBB.xls open.
I am running code that is in AAA.xls.
I want to run macro MyProc that is in BBB.xls.
For that I use this code:
Application.Run "BBB.xls!MyProc"
I get the error that the macro cannot be found.
I checked the file and macro names and they are right.
Is the Application line syntax not right?
Thanks for your time. Otto
PS: The 2 files reside in different folders. Could that be a problem?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Running a macro in another WB

Mark
Thanks for responding. Putting the target macro in the Personal.xls
file is just moving it from one open file to another open file. My problem
is that the macro cannot be found regardless of what other workbook it's in.
I tried putting the target workbook and macro in parentheses like you
did but that didn't work either. Otto
"Mark Dullingham" wrote in
message ...
Create a Personal.xlsb, you can choose this when you record a macro, then
place the code in a module in the Personal.xlsb and use the following

Application.Run ("Personal.xlbs!MyProc")

hth

Mark

"Otto Moehrbach" wrote:

Excel XP & Win XP
I have files AAA.xls and BBB.xls open.
I am running code that is in AAA.xls.
I want to run macro MyProc that is in BBB.xls.
For that I use this code:
Application.Run "BBB.xls!MyProc"
I get the error that the macro cannot be found.
I checked the file and macro names and they are right.
Is the Application line syntax not right?
Thanks for your time. Otto
PS: The 2 files reside in different folders. Could that be a problem?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Running a macro in another WB

The personal work book is different as it has a XLSB extension and is
specifically designed to allow macro's to be called from any open workbook,
it is not an actual woorkbbok in the same way as your AAA and BBB are.

I have tested this using a simple column hide macro starting with your code
and ending up with the one I posted and it works.

You could, of course, just have the macro in both workbooks!

"Otto Moehrbach" wrote:

Mark
Thanks for responding. Putting the target macro in the Personal.xls
file is just moving it from one open file to another open file. My problem
is that the macro cannot be found regardless of what other workbook it's in.
I tried putting the target workbook and macro in parentheses like you
did but that didn't work either. Otto
"Mark Dullingham" wrote in
message ...
Create a Personal.xlsb, you can choose this when you record a macro, then
place the code in a module in the Personal.xlsb and use the following

Application.Run ("Personal.xlbs!MyProc")

hth

Mark

"Otto Moehrbach" wrote:

Excel XP & Win XP
I have files AAA.xls and BBB.xls open.
I am running code that is in AAA.xls.
I want to run macro MyProc that is in BBB.xls.
For that I use this code:
Application.Run "BBB.xls!MyProc"
I get the error that the macro cannot be found.
I checked the file and macro names and they are right.
Is the Application line syntax not right?
Thanks for your time. Otto
PS: The 2 files reside in different folders. Could that be a problem?






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
Report with macro losing links to a particular worksheet after running macro santhu Excel Programming 0 March 1st 07 03:25 AM
disable user running macro from Tools Macro Steve Simons Excel Discussion (Misc queries) 4 September 28th 06 06:28 AM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to get onkey macro to fire while another macro is running Brian Murphy Excel Programming 8 August 25th 04 05:38 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 12:26 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"