Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
gowinder
 
Posts: n/a
Default How do I use VC++6.0 to protect a excel file to readonly


I use VC++6.0 to create a temp excel file, and I don't want other user
to modify it, I use _Workbook.ChangeFileAccess to set readonly, but it
cannot help, a exception throw out, the message is "cannot find
member", when I invoke ChageFileAccess function, the code is like
this:

COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,
VT_ERROR),vtTrue((short)TRUE),vtFalse((short)FALSE );
_Application *ExcelApp = new _Application;

ExcelApp-CreateDispatch("excel.application");



//ÉèÖÃΪÏÔʾ
ExcelApp-SetVisible(TRUE);
//µÃµ½WorkBooks
Workbooks ExcelBook=ExcelApp-GetWorkbooks();



Sheets ExcelSheet=ExcelBook.Add(vtOptional);
_Workbook workBook;
_Worksheet workSheet;
Range range;
workBook.AttachDispatch(ExcelApp-GetApplication());

ExcelSheet=workBook.GetSheets();

////////////////////////////////////////////
workSheet=ExcelSheet.GetItem(COleVariant((short)1) );
workSheet.Activate();

can anyone help me? Thanks!


--
gowinderPosted via http://www.officehelp.in - <a href="http://www.officehelp.in">Microsoft Office Software</a>

  #2   Report Post  
gowinder
 
Posts: n/a
Default


help!help!


--
gowinderPosted from - http://www.officehelp.in

Reply
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
Excel not detecting that a file is currently being edited cds_tech Excel Discussion (Misc queries) 1 June 27th 05 09:06 PM
Unable to create any link/hyperlinks in a particular excel file Nabanita Excel Discussion (Misc queries) 0 June 21st 05 11:52 AM
No option to password protect opening an excel / word file Andy Excel Discussion (Misc queries) 1 June 20th 05 03:54 PM
Excel startup switches Randy Excel Discussion (Misc queries) 9 June 14th 05 10:27 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 05:42 PM.

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"