View Single Post
 
Old 03-15-2011, 08:26 PM
bolpom bolpom is offline Windows Vista Office 2007
Novice
 
Join Date: Mar 2011
Location: London, UK.
Posts: 16
bolpom is on a distinguished road
Default Invoking a command line from inside Word

I sometimes like to use a Word document as a roadmap or control panel to summarise and explain (to me!) my work, with lots of active hyperlinks to relevant url's and executable programs.

As a sort of Windows Explorer allowing annotations, in other words.

I would like to be able to execute a .cmd or .bat file from some text or an object or a shape in a Word document, but this does not seem to work. It just brings up a cmd.exe window without carrying out the commands.

Similar to the above, I would like to be able to execute a command line with parameters from something in a Word document, in order to specify opening a file or url in different browsers or different switches, etc.

Maybe a macro could do this, by sensing the name of a shape or object and turning it into the invocation of the relevant command line.

(I realise that these facilities were probably intentionally disabled by Microsoft for security reasons. Even in 'allow all macros' and .docm mode. This latter might be thought relevant (thinking laterally) because the security exposure in running external programs might logically be considered comparable to running internal VB macros. Odd that 'allow all macros' is a global option stored away in normal.dotm. You should be able to flag just your own files as trusted.)

Rider. If you make a .lnk shortcut object to an executable file in Windows Explorer and drag and drop it into Word, it becomes an object that demands to be handled by Package. What is package, and is there any simple way of executing the file? Apart from making a hyperlink to the executable file, which I know works.
Reply With Quote