# Launch a program when another program opens

I would like a method for starting a program when another program starts. Specifically, I’d like a to open a MS Word document and have my citation manager open simultaneously (EndNote supports this function within MS Word preferences, but I recently switched citation managers).

The batch scripts I’ve seen so far, including this one, don’t fit the bill. I’d like to be able to open any existing Word document on my drive and trigger the second program.

-

One possible solution:

1) Create a batch file such as C:\ViewDoc.bat:

@echo off
start "Word" "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" %1
start "CiteMan" "Drive:\Path\to\Citation Manager.exe"


Edit the paths as required.

2) Right-click any .DOC file, click on Open with, browse and select the batch file:

Make sure the Always use the selected program to open this kind of file option is checked.

3) Do the same with any .DOCX file.

Now when you double-click to open any document, the batch file will run instead of Word directly. It in turn will launch Word and open the selected document, as well as launch the other program you want.

An alternate way to do this with any .DOCM macro-enabled document is to add the following code via the Developer tab / Visual Basic editor:

Private Sub Document_Open()
Shell "Drive:\Path\to\Citation Manager.exe"
End Sub


This will auto-launch the specified program whenever the .DOCM is opened.

-
That fits the bill. +1 for adding the .DOCM approach –  metasequoia Nov 19 '12 at 0:10