Author | Topic: Word events | |
---|---|---|
Altiy Zemlytskiy | Word events on Tue, 23 Apr 2013 22:09:33 +0300 Hi All, I have a problem with such code - LOCAL oWord LOCAL oOriginalDocument oWord := CreateObject("Word.Application") oWord:visible := .T. oWord:= oWord:dynamicCast( ActiveXObject() ) oWord:DocumentChange := {||msgbox("DocumentChange")} oWord:DocumentBeforeSave := {||msgbox("DocumentBeforeSave")} oOriginalDocument := oWord:documents:open("d:\test.doc" ,,,,,,,,,,,,,,,) oOriginalDocument:destroy() The event DocumentChange is fired, but DocumentBeforeSave doesn't. Does anybody know the reason? Many thanks in advance. Best regards, Altiy | |
Altiy Zemlytskiy | Re: Word events on Wed, 24 Apr 2013 06:29:35 +0300 Getting close. DocumentChange fires when I write oOriginalDocument:save(), but does not fares when I try to save the document with windows interface. Any good idea? > Hi All, > > I have a problem with such code - > > LOCAL oWord > LOCAL oOriginalDocument > > > oWord := CreateObject("Word.Application") > oWord:visible := .T. > oWord:= oWord:dynamicCast( ActiveXObject() ) > oWord:DocumentChange := {||msgbox("DocumentChange")} > oWord:DocumentBeforeSave := {||msgbox("DocumentBeforeSave")} > > oOriginalDocument := oWord:documents:open("d:\test.doc" ,,,,,,,,,,,,,,,) > > > oOriginalDocument:destroy() > > The event DocumentChange is fired, but DocumentBeforeSave doesn't. > Does anybody know the reason? > Many thanks in advance. > > Best regards, Altiy | |
Altiy Zemlytskiy | Re: Word events on Thu, 25 Apr 2013 08:24:45 +0300 Everything is solved, many thanks > Getting close. DocumentChange fires when I write > oOriginalDocument:save(), > but does not fares when I try to save the document with windows > interface. > Any good idea? > > >> Hi All, >> >> I have a problem with such code - >> >> LOCAL oWord >> LOCAL oOriginalDocument >> >> >> oWord := CreateObject("Word.Application") >> oWord:visible := .T. >> oWord:= oWord:dynamicCast( ActiveXObject() ) >> oWord:DocumentChange := {||msgbox("DocumentChange")} >> oWord:DocumentBeforeSave := {||msgbox("DocumentBeforeSave")} >> >> oOriginalDocument := oWord:documents:open("d:\test.doc" ,,,,,,,,,,,,,,,) >> >> >> oOriginalDocument:destroy() >> >> The event DocumentChange is fired, but DocumentBeforeSave doesn't. >> Does anybody know the reason? >> Many thanks in advance. >> >> > > Best regards, Altiy | |
Peter Alderliesten | Re: Word events on Fri, 26 Apr 2013 09:01:46 +0200 Altiy, > Everything is solved, many thanks And now I'm interested in your findings... Peter | |
Altiy Zemlytskiy | Re: Word events on Fri, 26 Apr 2013 15:32:00 +0300 Hi Peter, Very simple - I was stupid. My oWord was destroyed, because the procedure had been finished and all objects were destroyed. That's why the event was not fired. So if everything is written like in manual there is not any problem, oWord must be e.g. public variable. In my case I included it in the class of main window of application > Altiy, > >> Everything is solved, many thanks > And now I'm interested in your findings... > > Peter Best regards, Altiy | |
Peter Alderliesten | Re: Word events on Mon, 29 Apr 2013 15:26:59 +0200 Altiy, > Very simple - I was stupid. My oWord was destroyed, because the > procedure had been finished and all objects were destroyed. That's why > the event was not fired. So if everything is written like in manual > there is not any problem, oWord must be e.g. public variable. > In my case I included it in the class of main window of application Thanks for this feedback. Peter |