Check if VBA Code is Signed with C++

The following code explains how to check if the VBA code is signed or not using the VbaProject::IsSigned property. You can use any of your Excel files to test this code. For testing purposes, you can use this excel file used in the code.

Check if VBA Code is Signed in C++

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Path of input Excel file
    U16String inputFilePath = srcDir + u"sampleVBAProjectSigned.xlsm";

    // Create workbook
    Workbook workbook(inputFilePath);

    // Check if the VBA code project is signed
    std::wcout << U"Is VBA Code Project Signed: " << workbook.GetVbaProject().IsSigned() << std::endl;

    Aspose::Cells::Cleanup();
    return 0;
}

Console Output

Below is the console output of the above code using the sample excel file provided by the link.

  

Is VBA Code Project Signed: True