Represents digital signature for Spreadsheets VBA projects.
Provides ability to sign a VBA project in spreadsheet document formats such as Xlsm or Xltm. If multiple DigitalVBA extensions are added to DigitalSignOptions.extensions, only the first is used during signing.
The DigitalVBA type exposes the following members:
The setting that determines whether only the VBA project is signed. When True, the spreadsheet document itself is not signed; only the VBA project is signed.
Example
importzipfilefromgroupdocs.signatureimportSignaturefromgroupdocs.signature.domain.extensionsimportDigitalVBAfromgroupdocs.signature.optionsimportDigitalSignOptionsdefsign_spreadsheet_macros_only():# Sign macros within the spreadsheetwithSignature("sample.xlsm")assignature:sign_options=DigitalSignOptions()# Add extension for signing VBA project digitallydigital_vba=DigitalVBA("certificate.pfx","1234567890")digital_vba.sign_only_vba_project=Truedigital_vba.comments="Signed VBA macros"sign_options.extensions.append(digital_vba)result=signature.sign("signed_macros.xlsm",sign_options)print(f"Signatures added: {len(result.succeeded)}")# Verify that the VBA project signature part was addedwithzipfile.ZipFile("signed_macros.xlsm")aspackage:print("VBA project signed:","xl/vbaProjectSignature.bin"inpackage.namelist())