Hi there, im trying to manipulate excel file XLS with C# by using Microsoft.Office.Interop.Excel
the workbook im trying to manipulate has shared protection between users
i have the file pw and i have the pw of the cells which i want to access and edit.
if i try to do that from excel i do the following open the file type the pw
go to a cell double click on a cell to edit a dialogue apear asking me to provide pw i provide the pw and then i can edit
i exactly wanna do that from code
my code is as follow :
xl.Application excelApp = new xl.Application();
excelApp.Visible = true;
xl.Workbook newworkbook = excelApp.Workbooks.Open(@"C:\1.xls",
0, false, 5, "password", "", false, xl.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
xl.Sheets excelSheets = newworkbook.Worksheets;
xl.Worksheet excelWorksheet = (xl.Worksheet)excelSheets.get_Item("Sign On_Off");
excelWorksheet.Select(true);
xl.Range myrange = excelWorksheet.get_Range("b16", "b16");
myrange.Value2 = "testing";
the last line gives me this : The cell or chart that you are trying to change is protected and therefore read-only.
i cant unprotect the sheet cause that would mean i will have the file exclusive opened for me only and other users cant save changes
so my question is is there is way i can unprotect a cell only ? something like
myrange.unprotect("pw"); ?????!!!
thanks in advance