Class VbaProject

VbaProject class

Represents the VBA project.

public class VbaProject

Properties

NameDescription
CertRawData { get; }Gets certificate raw data if this VBA project is signed.
Encoding { get; set; }Gets and sets the encoding of VBA project.
IslockedForViewing { get; }Indicates whether this VBA project is locked for viewing.
IsProtected { get; }Indicates whether this VBA project is protected.
IsSigned { get; }Indicates whether VBAcode is signed or not.
IsValidSigned { get; }Indicates whether the signature of VBA project is valid or not.
Modules { get; }Gets all VbaModule objects.
Name { get; set; }Gets and sets the name of the VBA project.
References { get; }Gets all references of VBA project.

Methods

NameDescription
Copy(VbaProject)Copy VBA project from other file.
Protect(bool, string)Protects or unprotects this VBA project.
Sign(DigitalSignature)Sign this VBA project by a DigitalSignature
ValidatePassword(string)Validates protection password.

Examples


[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();
 // Init VBA project.
VbaProject vbaProject = workbook.VbaProject;
//Saving the Excel file
workbook.Save("book1.xlsm");

 [Visual Basic]

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Init VBA project.
Dim vbaProject as VbaProject  = workbook.VbaProject
'Saving the Excel file
workbook.Save("book1.xlsm")

See Also