Mega Code Archive

 
Categories / Delphi / Files
 

How to open a password protected xls file and save it without password

Title: How to open a password-protected xls-file and save it without password 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;