views:

12

answers:

1

i dont know if this is possible, but i need to do the following. When i make changes to a word document on my pc (save it and the date changes everytime), I want a .exe file on the same computer to run. Is there any way or third party software, with which i can achieve this?

A: 

Probably the easiest way which will work under most circumstances is to put the code below inside a VBA module, either in Word's Normal.dot template, another dedicated global templated or in a specific document:

Option Explicit

Private Declare Function ShellExecute _
    Lib "shell32.dll" _
        Alias "ShellExecuteA" ( _
            ByVal Hwnd As Long, _
            ByVal lpOperation As String, _
            ByVal lpFile As String, _
            ByVal lpParameters As String, _
            ByVal lpDirectory As String, _
            ByVal nShowCmd As Long) _
As Long

Public Sub FileSave()

  ShellExecute 0, "open", "C:\Windows\System32\calc.exe", "", "", 0
  ActiveDocument.Save

End Sub
0xA3