Application.run does not work !!!!

KoolYute

New Member
Joined
Feb 8, 2012
Messages
34
EXCEL 2003
WINDOWS XP SP2
---------------------


Hi,

I am trying to run a macro in another workbook using variable name but it will not work.
Works when I specify the fie name but I have 25 files so the variable would help.


Here is a sample:
The first one works with the full name but the second will not work.

1. Application.Run ("'Smith John - Call Adherence Reporting 2013_SD.xls'!Master_Module")
2. Application.Run (Wb2.Name & "!" & ".Master_Module")

Thanks in advance,

BJ.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Are you sure Wb2.Name is returning what you need?
 
Upvote 0
Hi,

This may just be a typo for this post or your problem.
There's a full stop in front of .Master_Module on the second.

Other than that I can only think it is path related.

Code:
Application.Run (Wb2.Name & "!" & "[COLOR=#ff0000].[/COLOR]Master_Module")
 
Upvote 0
You need:
Code:
Application.Run "'" & Wb2.Name & "'!Master_Module"
if you may have spaces in the file name.
 
Upvote 0

Forum statistics

Threads
1,217,680
Messages
6,137,948
Members
450,100
Latest member
mscetr

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