LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Run code from another workbook

I am trying to do as the Subject says.

I found a site that has info on that.

<*******

Sub CallCodeFromAnotherWorkbook()
Application.Run "AnotherWorkbook.xls"!OtherMacro
End Sub

To replicate:
1.Open both the example workbooks
2.Press the button.
3.You will then see a message box saying that the other code is being run.
4.The Syntax for Application.Run is: "WorkbookName.xls!MacroName"
5.Using this tip, you can run all the macros from one workbook using another workbook.

<*******


I down loaded their two books and after correcting what I guess was a typo, it did work.

Everything I've tried with my Books fails.

I have three Books and I am try to call two macros from other books from the book long. The books a

long
Book_A
Book_AA

Macro in the book long is:

Sub BooK_A_Book_AA_Macro_Call()
Application.Run "Book_A.xls!AbookToLong"
Application.Run "Book_AA.xls!AAbookToLong"
End Sub

The Macro in Book_A is:

Sub AbookToLong()

The Macro in Book_AA is:

Sub AAbookToLong()


Notice the extensions are .xls (saved as 97-2003). The download example came as .xls.

I have tried saving everything as Excel Macro-Enabled and have the .xlsm extension but nothing works.

No error number, just yellows out the first line of Application.Run...etc.

I have tried calling only one macro and that does not work either.

Seems to like it should work with Excel 2010.

Do you see anything I'm doing wrong?

Thanks.
Howard













 
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
VBA code for pasting links -- modifying RDB code for summary workbook Aikistan Excel Programming 11 March 29th 13 09:34 PM
How do I call up a line of code that references a cell/range in theactive workbook workbook where I am running my macro from? Lav Excel Programming 2 November 11th 08 05:04 PM
Code to change code in a sheet and workbook module Otto Moehrbach Excel Programming 11 November 11th 07 07:20 PM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
Code in one workbook to call code in another XL file [email protected] Excel Programming 2 August 1st 05 03:37 PM


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