ljee
asked on
Automation, Word - Assigning OnQuit programatically?
Hi,
The code below fails:
procedure TSomeObject.Quitting(Sende r: TObject);
begin
messagebeep(0);
end;
procedure TSomeObject.SomeProcedure;
var
FApplication: Variant;
begin
try
FApplication := GetActiveOleObject( 'Word.Application );
except
FApplication := CreateOleObject( 'Word.Application' );
end;
FApplication.OnQuit := Quitting;
// the above line fails with compiler error 'Not enough parameters'.
..........
end;
Actually my goal is to have my application receive a notification when Word is closed. Is that possible? How?
The code below fails:
procedure TSomeObject.Quitting(Sende
begin
messagebeep(0);
end;
procedure TSomeObject.SomeProcedure;
var
FApplication: Variant;
begin
try
FApplication := GetActiveOleObject( 'Word.Application );
except
FApplication := CreateOleObject( 'Word.Application' );
end;
FApplication.OnQuit := Quitting;
// the above line fails with compiler error 'Not enough parameters'.
..........
end;
Actually my goal is to have my application receive a notification when Word is closed. Is that possible? How?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Scay7. You got the points, your second alternative with IsObjectActive works fine for me.
This question can be closed (frankly it's a long time since I did not visited EE, I don't rememeber what am I supposed to do now??).
regards,
ljee
This question can be closed (frankly it's a long time since I did not visited EE, I don't rememeber what am I supposed to do now??).
regards,
ljee
here we go a nice picture of how to accept the answer :P
https://www.experts-exchange.com/help.jsp#hi68
Peace Scay7
https://www.experts-exchange.com/help.jsp#hi68
Peace Scay7
ASKER
geee, thanks :-)
ASKER
thx