Automation in excel

S

SnOOpss

Hello !
I work on VS 2005 and I use this sample to my application
http://support.microsoft.com/kb/q216686/ . I use automation to control excel
WITHOUT mfc and WITHOUT #import only pure api win32.
It's work perfectly but I have a big problem : The worksheet is protect in
excel

code VBA

Sheets(1).Protect Password:="XXXXXX", _
UserInterFaceOnly:=True


Someone know the params to invoke to unprotect the sheet or to execute a
macro by automation ?
I try this without chance.


bool MyExcel::SetProtect(bool b) {
VARIANT x;
x.vt = VT_I4;
x.lVal = b;
x.bstrVal=SysAllocString(L"XXXXXXXX");
//AutoWrap(DISPATCH_METHOD, NULL, pdispWorksheet, L"Protect", 0);
AutoWrap(DISPATCH_PROPERTYPUT, NULL, pdispWorksheet, L"Protect", 1, x);
return true;
}

I have the message, member unknow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top