![]() |
Stop select and copy of excel sheet in protect mode
Hi All,
I have a SDI application developed using MFC Appwizard. This is an office automation application and MS Excel is automated in this application. In this application I have shown an excel file in right pane (client view) of the application. I want to show my excel files in right pane in protected mode such that user can only view the files can not copy and write. I protect the excel file as : oWSheet = oWBook.GetActiveSheet(); oWSheet.Protect(COleVariant(_T("password")),covTru e,covTrue,covTrue,covTrue, covOpt,covOpt,covOpt,covOpt,covOpt,covOpt,covOpt,c ovOpt, covOpt,covOpt,covOpt); oWSheet.SetEnableSelection(-4142); oWBook.SaveAs(COleVariant(_T("c:\\test.xls")),covO ptional,COleVariant(_T("") ),COleVariant(_T("")), covFalse,covFalse,1,covOptional,covFalse,covOption al, covOptional,covOptional); oWBook.Save(); //*****File is protected and can not be selected, copied******/ oWBook.Close(covOptional,covOptional,covOptional); //*****Problem occurs after this statement******/ oWBook.ReleaseDispatch(); oWBooks.Close(); oWBooks.ReleaseDispatch(); oApp.Quit(); oApp.ReleaseDispatch(); Problem occurs at this statement. oWBook.Close(covOptional,covOptional,covOptional ); As file closed its protection lost in such a way that file can not be written and can be selected and copy. I want to stop this. Before closing the file as I saw in MS Excel (visible mode) file is completely protected and can not be selected, copy and written. Reply ASAP. With Best Regards |
All times are GMT +1. The time now is 07:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com