Macros in different workbooks

JohnG

Board Regular
Joined
Feb 18, 2002
Messages
165
Does anyone know how to call a macro that is in one workbook from another in Excel 2000
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
On 2002-02-19 13:21, JohnG wrote:
Does anyone know how to call a macro that is in one workbook from another in Excel 2000

If you have both workbooks open, you can just call the macro by it's name (unless you've declared the Sub/Function as Private).

-rh
 
Upvote 0
I tried just typing the macro name in and got the error message that sub or function had not been created.
On 2002-02-19 13:31, Russell Hauf wrote:
On 2002-02-19 13:21, JohnG wrote:
Does anyone know how to call a macro that is in one workbook from another in Excel 2000

If you have both workbooks open, you can just call the macro by it's name (unless you've declared the Sub/Function as Private).

-rh
 
Upvote 0
Are both workbooks open? Also, how are you calling your functions? Can you post the code that you are calling FROM and the code that you are calling?

Thank you,

-rh
 
Upvote 0
Both books are open

'Workbook "Test"
Sub CallMacro()
CallTestMacro
End Sub

'Workbook "CallTest"
Sub CallTestMacro()
Msgbox "Routine called",VBOkOnly, Thisworkbook.name
End Sub
On 2002-02-19 14:04, Russell Hauf wrote:
Are both workbooks open? Also, how are you calling your functions? Can you post the code that you are calling FROM and the code that you are calling?

Thank you,

-rh
 
Upvote 0
How's about:

application.run("CallTestMacro")

instead of "CallTestMacro"

Cheers,

Nate
This message was edited by NateO on 2002-02-19 14:41
 
Upvote 0
Thanks all it works now....If the workbook is found to be open the macro is called.
On 2002-02-19 14:52, Russell Hauf wrote:
Try this:

Application.Run ("CallTest.xls!CallTestMacro")

-rh
 
Upvote 0

Forum statistics

Threads
1,213,522
Messages
6,114,112
Members
448,549
Latest member
brianhfield

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top