View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl Steve Yandl is offline
external usenet poster
 
Posts: 284
Default Run Excel macro from XP shortcut menu

To make an item appear in the Windows Explorer shortcut (context or right
click) menu for folders, you would create a new registry key under
HKEY_CLASSES_ROOT\Folder\shell using the name you want your user to see.
Then you create a subkey under that new subkey named 'command' and give it a
default value that is the command line you want executed. The problem with
this approach is that it can cause quirky behaviors with the Explore and
Open options already present by default. You also have to figure out how to
let your Excel macro know which folder you clicked on because, presumably,
you want the macro to do something with that folder or its contents.

I'm guessing that you want a macro that will display folder contents or
other folder information in a spreadsheet. To do something like that, I
find it works best to use a vbScript helper file to launch Excel and run the
macro because you can then use the 'Arguments' property of the 'WScript
Object' to capture the full path to the folder and feed that to your macro.
Place the vbScript or a shortcut to it in the SendTo folder and then the
user can locate the helper file by right clicking the folder and scanning
the SendTo flyout options from the context menu.

Steve



"hmm" wrote in message
...
I want to create an Excel macro that would be activated by the user
right-clicking on folder in Windows Explorer. How would I even begin to
learn how to arrange such a shortcut activation?