LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect sheet unchecking "Select locked cells" has undesiredresults wal Excel Discussion (Misc queries) 1 September 1st 08 03:28 PM
select a range, copy it to a new sheet Dave F Excel Discussion (Misc queries) 1 September 22nd 06 08:06 PM
Protect excel sheet and still copy text or object w/o unprotectin. Saint Excel Discussion (Misc queries) 2 May 29th 06 12:44 AM
How to stop the 'select sheet' window pop up deepakmehta Excel Programming 2 December 18th 05 10:53 PM
Select rows and copy to another sheet. Juan Excel Programming 6 March 29th 05 12:53 AM


All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"