Open Password Protected Excel Workbook C# -
i trying open password protected excel workbook. have tried many different ways of unprotecting programatically or inputting password, yet every time program runs, m prompted input password. doing wrong?
public class attenfile { private excel.application excel; private excel.workbook wb; private excel.worksheet worksheet; private excel.range range; private const int startrow = 3; private int row; private static object missingvalue = system.reflection.missing.value; public attenfile(string attenfiledir) { excel = new excel.application(); wb = excel.workbooks.open(attenfiledir, missingvalue, missingvalue, missingvalue, "nso" ); wb.unprotect("nso"); worksheet = (excel.worksheet) wb.sheets[1]; worksheet.unprotect("nso"); range = worksheet.usedrange; } }
Comments
Post a Comment