public static void Run()
        {
            //ExStart:CheckifVBAProjectisProtectedandLockedforViewing

            //The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Load your source Excel file.
            Workbook wb = new Workbook(dataDir + "sampleCheckifVBAProjectisProtected.xlsm");

            //Access the VBA project of the workbook.
            Aspose.Cells.Vba.VbaProject vbaProject = wb.VbaProject;

            //Whether "Lock project for viewing" is true or not.
            Console.WriteLine("Is VBA Project Locked for Viewing: " + vbaProject.IslockedForViewing);

            //ExEnd:CheckifVBAProjectisProtectedandLockedforViewing
        }
        public static void Run()
        {
            //ExStart:FindoutifVBAProjectisProtected

            //Create a workbook.
            Workbook wb = new Workbook();

            //Access the VBA project of the workbook.
            Aspose.Cells.Vba.VbaProject vbaProj = wb.VbaProject;

            //Find out if VBA Project is Protected using IsProtected property.
            Console.WriteLine("IsProtected - Before Protecting VBA Project: " + vbaProj.IsProtected);

            //Protect the VBA project.
            vbaProj.Protect(true, "11");

            //Find out if VBA Project is Protected using IsProtected property.
            Console.WriteLine("IsProtected - After Protecting VBA Project: " + vbaProj.IsProtected);

            //ExEnd:FindoutifVBAProjectisProtected
        }
        public static void Run()
        {
            //ExStart:PasswordProtecttheVBAProjectofExcelWorkbook

            //The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Load your source Excel file.
            Workbook wb = new Workbook(dataDir + "samplePasswordProtectVBAProject.xlsm");

            //Access the VBA project of the workbook.
            Aspose.Cells.Vba.VbaProject vbaProject = wb.VbaProject;

            //Lock the VBA project for viewing with password.
            vbaProject.Protect(true, "11");

            //Save the output Excel file
            wb.Save(dataDir + "outputPasswordProtectVBAProject.xlsm");

            //ExEnd:PasswordProtecttheVBAProjectofExcelWorkbook
        }