You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Hi Maccas
I just checked that Microsoft Shells controls etc. was turned on.
Hope that was what you meant by adding the reference. Or should it be somewhere in the code? In that case I wouldn't know how to do that.
greetz,
Wim
Well then, I'm a bit confused as that command always works for me. I'm not 100% sure you've got the reference linked up ok but it sounds like you've done it right. Forgive me if this is preaching to the converted but for avoidance of confusion, the following process you implement to add a reference to your VBA project:
1) Go to the VBE (Visual Basic Editor) i.e. the window with your VBA code in.
2) Ensure you are looking (have active) at a code pane of the project you want to add a reference to. e.g. looking at the problematic code will work. Note if you don't ensure this step you'll add a reference to the wrong project and the error will remain.
3) Click on the Tools menu.
4) Select the first menu option, References...
5) This will open up a dialogue box with a sub-window with lots of checkbox items in it.
6) Scroll down the list to an item called "Microsoft Shell Controls and Automation" and check it.
7) Click ok on the dialogue box.
8) You've added the reference.
If this doesn't work then I'm out of ideas - sorry! You could always try Google for cases of Shell not working for launching apps.
I googled a bit... http://support.microsoft.com/kb/149570
"Only files that have an .exe, .com or .bat extension can be executed through the Shell function."
This can explain the problem perhaps.
Wim