#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
A solution
It seems if you write a VB console application which uses "shell" to issue the command, and drag this application into word, the resulting Word object will indeed execute the command.
The only security advantage I can see in this arrangement is based on the rather small additional intelligence which may be needed to use vb rather than straight cmd.exe. This might discourage a few amateur tinkerers but not any serious criminal virus merchants. EDIT: Or of course, more directly, put a shape or some text in the word file and provide a vb macro responding to a mouse click by executing the command line as above. But probably the above way makes it possible to drag or copy and paste the object back into Windows Explorer and use it. "1. You have a rich abundance of routes and options to choose from. 2. But not all of them work." Last edited by bolpom; 03-16-2011 at 03:31 AM. Reason: More directly... |
Tags |
executables hyperlinks |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Command Line Argument | xJediDadx | Outlook | 1 | 02-21-2011 03:47 PM |
Command Line Switches | Ringmaster | Office | 0 | 08-10-2010 06:27 AM |
Page break inside tables.(word 2003) | englund33 | Word Tables | 1 | 06-15-2010 02:00 AM |
Shortcut inside Word 2010 or 2007 to format text | Ross | Word | 0 | 03-03-2010 05:54 PM |
Outlook 2003 - IMAP + Exchange. Set Default via Command-Line? | Petrucci914 | Outlook | 1 | 08-11-2009 07:47 AM |