如何開啟有帶密碼的 xls 檔案
發表於 : 2008年 11月 28日, 16:08
參考資料, http://www.scalabium.com/faq/dct0153.htm
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=68463
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=68463
代碼: 選擇全部
var
xls, xlw: Variant;
begin
{load MS Excel}
xls := CreateOLEObject('Excel.Application');
{open your xls-file}
xlw := xls.WorkBooks.Open(FileName := 'd:book1.xls', Password := 'qq',
ReadOnly := True);
{save with other file name}
xlw.SaveAs(FileName := 'd:book2.xls', Password := '');
{unload MS Excel}
xlw := UnAssigned;
xls := UnAssigned;
end;