Hi,
I have a Workbook A where I do most of my work. I have also a Workbook B where I store data.
I need a macro in my Workbook A that opens and run a specific macro in my workbook B.
To open Workbook B Im using the following codes in Workbook A
Now that Workbook B is open, to run the macro in Workbook B (macro name= "DataColor") I tried:AddressB = "c:\Depot\DataStore.xls" 'DataStore.xls is the workbook B. Set xxDataStore =workbook.open (AddressB) 'Both lines are written in a macro in workbook A.
This last line (RUN) is not working to me. What am I doing wrong?application.run ("DataStore.xls!DataColor"). 'This line is in a macro in Workbook A
Try removing the brackets
Application.Run "DataStore.xls!DataColor"
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thanks Roy.
I tried your suggestion in a new set of workbooks and it works fine.
But now I tried in my original documents and it sends the error 1004/(It cant find the macro).
Do I need to write the module name between the filename and macro name?
I already checked the filename and macro name to be sure it is not a typo.
Do you know of any reason it couldnt find a macro if it is in there?
I thank you very much.
I found the problem.
It looks like the run command cant handle spaces or "-" in the finename.
In my drive, the filename has a space ("DataStore V3.xls").
I rename the filename (in my hardrive and in the macro procedure) to "DataStoreV3.xls" and now it works fine.
Thanks a lot Roy.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks