From: David Mullet Date: 2008-09-13T23:15:24+09:00 Subject: Re: win32ole encript document excel Foreero Ivan wrote: > does anybody how to protect a excel document made with ruby and then put > a password /?? To password-protect an Excel workbook, set the workbook object's Password property before calling the SaveAs() method: wb.Password = 'MyPassword' wb.SaveAs('c:\temp\xlpsw.xls') To open a password-protected workbook, either call the standard Open() method... wb = xl.Workbooks.Open('c:\temp\xlpsw.xls') ...and then you will be prompted to enter the password... ...or pass the password as an argument hash to the Open() method: wb = xl.Workbooks.Open('c:\temp\xlpsw.xls', {'password' => 'MyPassword'}) Hope that helps. David http://rubyonwindows.blogspot.com/ http://rubyonwindows.blogspot.com/search/label/excel -- Posted via http://www.ruby-forum.com/.