using namespace Excel; int main(array<System::String ^> ^args) { Excel::_ApplicationPtr pXL; try { pXL.CreateInstance(L"Excel.Application");//ok, starts excel pXL->PutVisible( 0, VARIANT_TRUE );//ok, makes excel visible WorkbooksPtr pBooks = pXL->Workbooks;//ok _WorkbookPtr pBook = pBooks->Add((long)xlWorksheet);//ok, Opens Sheet1 _WorksheetPtr pSheet = pXL->ActiveSheet; pSheet->Name = "My Sheet";//ok, renames Sheet1 to My sheet Range * pRange = pSheet->GetRange("A1","A1");//ok pRange->PutValue2( L"1000" );//not ok, crashes with this error /* Attempted to read or write protected memory */ }
PutValue2
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)