Need help VBA - Run procedure of project in another Workbook from current Workbook

Fable09

New Member
Joined
Nov 15, 2014
Messages
36
Hi everyone,

I want to run a procedure of project in another Workbook (wb2) from current Workbook (wb1)

-This procedure was not created by me and too complicated for me to understand.
-This procedure has Arguments, like "Case 1","Case 2",etc
-I do have wb2 open

I was searching and found two approaches but I still don't know the code

Approach 1: Run procedure directly from current Workbook

Application.Run("wb2"."'!MacroName")

I tested and this code works with procedure without arguments, with arguments like the one i want to run it returns the error

I only want to run with Argument "Case 1"

Approach 2: the procedure I want to run is link to a button ( Button 1 )

I want to write a short Macro to Left Click that Button 1 so the procedure will run from there


Please help !


 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try...

Code:
Application.Run "'" & wb2.name & "'!MacroName", Case1
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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