VBA(Visual Basic for Applications)プロジェクトが保護されて表示ロックされているかどうかを確認
Contents
[
Hide
]
可能な使用シナリオ
Aspose.Cellsを使用して、ExcelファイルのVBA(Visual Basic for Applications)プロジェクトが保護されて表示ロックされているかどうかを確認できます。
サンプルコード
次のサンプルコードは、サンプルExcelファイル を読み込み、そのVBA(Visual Basic for Applications)プロジェクトが保護されて表示ロックされているかどうかを確認します。 参照のために、コンソール出力もご覧ください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(CheckifVBAProjectisProtectedandLockedforViewing.class) + "WorkbookVBAProject/"; | |
// Load your source Excel file. | |
Workbook wb = new Workbook(dataDir + "sampleCheckifVBAProjectisProtected.xlsm"); | |
// Access the VBA project of the workbook. | |
VbaProject vbaProject = wb.getVbaProject(); | |
// Whether "Lock project for viewing" is true or not. | |
System.out.println("Is VBA Project Locked for Viewing: " + vbaProject.getIslockedForViewing()); |
コンソール出力
上記のサンプルコードを提供された サンプルExcelファイル で実行した場合のコンソール出力が以下に示されています。
Is VBA Project Locked for Viewing: true