Could somebody tel me how to unlock the vba project of my protected excel file?
I tried with below C# code:
Exc.wbook = (Excel._Workbook)Exc.Workbooks.Open(FilePath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true);
Exc.VBE.ActiveVBProject = Exc.wbook.VBProject;
Exc.Visible = true;
SendKeys.SendWait("%{F11}^r{TAB}~" + sPrd + "~~%{F11}");
This didn't unlock the vbaproject.
I tried with this C# code too....didn't work.
Exc.wbook = (Excel._Workbook)Exc.Workbooks.Open(FilePath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true);
Exc.VBE.ActiveVBProject = Exc.wbook.VBProject;
Exc.Visible = true;
Exc.Unprotect(sPrd );
I have put fake code to follow my comp rules.
Please look into it and tel me what`s wrong with my code.