DDE Question (I think)

KenMillard

Board Regular
Joined
Apr 25, 2007
Messages
151
I want to set up an action (run) in windows explorer (tools-folder options - file types - advanced) so that I can open certain text files with Excel and automatically trigger scripts to parse the data.

The scripts are stored in a file that may or may not be open. Is there a dde command that can be used to tell excel to open the file with the scripts and execute a macro that will accept the filepath of the file launched in windows explorer?

When I use %1 for the dde message i get the filepath in the current cell. It will open excel if it's not open but I'm having trouble getting it to open the script file and send the filepath.

If I could get it to open the script file and input the the filepath in the active cell, I could proably work with that.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I finally figured it out

[open("c:\myworkbook")] [Run("'MacroName ""%1""'")]

In the dde message field will open c:\myworkbook and pass the file path to the MacroName macro. The syntax for passing a variable through dde seems to be the same as that used to pass a variable from a toolbar button.
 
Upvote 0
Re: I finally figured it out

[open("c:\myworkbook")] [Run("'MacroName ""%1""'")]

In the dde message field will open c:\myworkbook and pass the file path to the MacroName macro. The syntax for passing a variable through dde seems to be the same as that used to pass a variable from a toolbar button.


This doesn't work in windows 7. Does anyone know how to implement this in windows 7? I was able to get to program associations through control panel but I was unable to find any sort of advanced options.

I want to be able to right click on the file and have a "run" option and an "edit" option. Run will open excel and run a script that will open the file that was right clicked and perform actions based on file contents. Edit will open the file with wordpad.


The syntax listed above will work in XP for the run command.

I'm under the impression that this can be done but it needs to be done with a registry edit?

That kind of sucks but I guess, if I can figure it out I should be able to create a registry key that can automatically be installed so maybe more up front work but easier in the long run?
 
Upvote 0
I guess this is more of a windows issue and less of an excel question but...


I was able to isolate the registry keys required in XP and create a .reg file that will automatically create those entries on an XP machine. That's cool because it's much easier than editing the file options manually.

From what I've read, that won't help me in Win7 though.


Unless certain parts of the registry are the same. I guess I could try installing the .reg file on a win7 machine (after backing up of course) but it seems unlkely that it would work.
 
Upvote 0

Forum statistics

Threads
1,224,803
Messages
6,181,055
Members
453,015
Latest member
ZochSteveo

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