How can I add an EXE file to a Word toolbar?Question asked on July 24, 2005 11:30 PM :: Permalink :: Comments (0) :: TrackBacks (1)Microsoft Word is a very powerful and flexible program, especially when it comes to it toolbars or CommandBars, as Microsoft refers to them. There are two different methods of creating having a button point to an outside program. One is by using a hyperlink and the other is by using a Visual Basic for Applications (VBA) macro. Both are simple to the do and the only difference is in how the external program is called, which also changes how Word reacts in regards to security. When using a hyperlink, Word treats it as coming for an unknown source and will display warnings asking if you really want to launch the program. It's the same as when you click on a EXE file from inside Internet Explorer, a warning displays telling you of the dangers of using an unknown program. With a VBA macro, all the security settings are based on the trustworthiness of the macro itself. Once you allow the macro to run, everything it does is deemed to be safe, so the external program will launch with no warnings. Safety issues aside, I'm going to focus on the VBA method since I think most folks would only be adding an EXE to their Word toolbar that they already trust and would become annoyed with the extra warnings rather quickly. Also, although I'm using Word here, these steps can be repeated in just about every other Microsoft Office application. The steps outlined are for Word 2003 and may vary slightly for other versions of Word.
Sub RunNotepad() Shell Pathname:="C:\WIndows\Notepad.exe", _ WindowStyle:=vbNormalFocus End Sub
The Shell command supports several different options for how the external program is opened. View the VBA help file for more information. CategoriesMicrosoft Office
1 TrackBacksListed below are links to blogs that reference this entry: How can I add an EXE file to a Word toolbar?. TrackBack URL for this entry: http://www.askwestley.com/cgi-sys/cgiwrap/wannis/managed-mt/mt-tb.cgi/3
» Salons St. Louis from Hair Salons St. Louis
Excellent thread, I saw this really great thread today and I wanted to link to it. Thanks again for taking the time to post. Read More |
|
Leave a comment