VaR <br/> V: variant; <br/> Y: integer; <br/> begin <br/> If opendialog1.execute then <br/> begin <br/> V: = createoleobject ('excel. application '); <br/> try <br/> v. workbooks. open (opendialog1.filename); <br/> v. worksheets [1]. activate; <br/> Y: = v. activesheet. usedrange. rows. count; <br/> try <br/> if y> 1 then <br/> begin <br/> v. cells [1, 5]. value: = 'wl time'; <br/> v. cells [1, 6]. value: = 'ls time'; <br/> v. range [V. cells [2, 5], V. cells [y, 5]. formular1c1: = '= (RC [-1]-RC [-2]) * 24'; <br/> v. range [v. cells [2, 6], V. cells [y, 6]. formular1c1: = '= (RC [-3]-RC [-4]) * 24'; <br/> end <br/> else showmessage (' the specified file has no data. '); <Br/> finally <br/> v. displayalerts: = false; // No <br/> v. activeworkbook. close (true, opendialog1.filename); // Save the disk and exit <br/> v. quit; <br/> end; <br/> quit T <br/> v. displayalerts: = false; <br/> v. workbooks. close; <br/> v. quit; <br/> showmessage ('excel initialization failed, Excel may not be installed, or other errors. '); <Br/> end; <br/>