0

I am trying to check if an uploaded excel file contains Macro's. I am using Spreadsheetgear for opening excel files. Is there a way to check if it contains macro's? I do not have to run, change or open the macro's, just need to know if they exist.

Bartvandee
  • 289
  • 3
  • 19
  • 1
    SpreadsheetGear provides no API to access the VBA portion of Excel files, so there's no definitive way to determine if macros are present in a given file. For Open XML files (*.xlsx and *.xslm), only the *.xlsm file format allows for macros to be present in the file, so checking IWorkbook.FileFormat == FileFormat.OpenXMLWorkbookMacroEnabled could serve as a "hint" that macros *might* be present in the file, though this is far from a certainty. For the older Excel 97-2003 (*.xls), there is no unique FileFormat enum option to check against, so a similar approach couldn't be used. – Tim Andersen Aug 09 '17 at 14:59
  • Thank you, this will do the trick for us. – Bartvandee Aug 14 '17 at 06:09

0 Answers0