Hi,
I have a problem with an OLEVariant (connects to Excel).
When I cloase a particualr form I want to make sure that the Excel object is also closed, so I have used
If ExcelServer <> Unassigned then
begin
ExcelServer.ActiveWorkbook.Close (False);
if ExcelServer.Workbooks.Count = 0 then
ExcelServer.Quit;
ExcelServer := Unassigned;
end
....
Which is ok if the ExcelServer was never assigned during the program execution, i.e. the user didn't want to do anything with Excel.
However, it fails with an "Invalid Variant Operation Displatch = Empty" message if I actually do setup a link to Excel.
If I change the code
if ExcelServer <> Null then
it also fails.
Anybody got any thoughts in this?
Dave