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.
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
Are you sure Wb2.Name is returning what you need?
 

daverunt

Well-known Member
Joined
Jul 9, 2009
Messages
1,887
Office Version
  1. 2013
Platform
  1. Windows
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")
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,118
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You need:
Code:
Application.Run "'" & Wb2.Name & "'!Master_Module"
if you may have spaces in the file name.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,957
Messages
5,599,046
Members
414,281
Latest member
Engjamal2021

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
Top