Digital Signature for Excel Macro

Our project has an excel template (.xlt) and an add-in file (.xla). These files are used to create the dataview. Dataview is nothing but a kind of report. Xla contains code for creating controls for creating, deleting, managing the dataview and its contents. These controls are OCX controls created in VC ++ to create a dataview. We have additional code separately and the template file separately.

xlt and xla were digitally signed to ensure that the code is evidence of unauthorized access. Everything worked fine until a digital signature appeared. Creating a dataview is created by opening the template file (.xlt) and saving the file in the .xls extension, without changing the digitally signed xlt and xla files. When we try to save this, we get the following message: "You are trying to change a signed project. You do not have a suitable key to sign the project ..."

When we give Save changes and discard the signature , the signature is lost only for the created new file. The signature remains unchanged for xlt and xla.

We also tried to manually edit the cells in excel and save it, but we do not get this message above. Only after creating a dataview using the OCX control and saving them does the above message pop up.

+1
source share
2 answers

What are you trying to protect? Did you sign the entire workbook / template, or did you only sign the code?

.xls is a copy of .xlt, so the template signature is also copied to xls. Ideas:

  • Try signing only the code in the template. In the IDE, use Tools → Digital Signature (Excel 2002/2003)
  • Remove all code from the template and put it in the add folder
  • If this is too complicated, add a second code only with the template
0
source

Source: https://habr.com/ru/post/1540592/


All Articles