Passwortschutz für das VBA Projekt der Excel Arbeitsmappe mit Node.js via C++
Contents
[
Hide
]
Passwortschutz für das VBA-Projekt der Excel-Arbeitsmappe in Node.js
Sie können das VBA (Visual Basic for Applications)-Projekt einer Arbeitsmappe mit Aspose.Cells mit VbaProject.protect(boolean, string)-Methode passwortschützen.
Beispielcode
Der folgende Beispielcode lädt die Beispiel-Excel-Datei, greift auf ihr VBA-Projekt zu, schützt es mit einem Passwort und speichert es schließlich als Ausgabedatei.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Load your source Excel file.
const workbook = new AsposeCells.Workbook(path.join(dataDir, "samplePasswordProtectVBAProject.xlsm"));
// Access the VBA project of the workbook.
const vbaProject = workbook.getVbaProject();
// Lock the VBA project for viewing with password.
vbaProject.protect(true, "11");
// Save the output Excel file
workbook.save(path.join(dataDir, "outputPasswordProtectVBAProject.xlsm"));