Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2011, 08:26 PM
bolpom bolpom is offline Invoking a command line from inside Word Windows Vista Invoking a command line from inside Word Office 2007
Novice
Invoking a command line from inside Word
 
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
  #2  
Old 03-16-2011, 03:03 AM
bolpom bolpom is offline Invoking a command line from inside Word Windows Vista Invoking a command line from inside Word Office 2007
Novice
Invoking a command line from inside Word
 
Join Date: Mar 2011
Location: London, UK.
Posts: 16
bolpom is on a distinguished road
Default 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...
Reply With Quote
Reply

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
Invoking a command line from inside Word 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
Invoking a command line from inside Word Outlook 2003 - IMAP + Exchange. Set Default via Command-Line? Petrucci914 Outlook 1 08-11-2009 07:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft