Ruby version 1.9.1p430 running on W7 with Office 2010.
I am trying to catch the DocumentBeforeClose event but I cannot even get close to get it to work!
I have followed some examples using Excel where the SheetSelectionChange is handled. It works without any problem.
Using the same process, I wanted to handle the above Word event.
My code fails at the WIN32OLE_EVENT.new statement. Here is what I am using:
require 'win32ole'
wd = WIN32OLE.connect('Word.Application')
wd.visible = true
doc = wd.Documents.Add
ev = WIN32OLE_EVENT.new(doc, 'ApplicationEvents4')
The error I get is:
ev = WIN32OLE_EVENT.new(doc, 'ApplicationEvents4') RuntimeError: failed to query IConnectionPoint HRESULT error code:0x80040200
I have looked extensively for the correct content for the name of the sink in the WIN32OLD_EVENT statement but this is the best I have come up with and its obviously incorrect!!
I would be most grateful if someone can point me in the right direction. I would be interested to hear if anyone has managed to succesfully handle Word events from Ruby.
Thanks and regards
Graham Jones