Digital Signature in XLSM template file
In our case, we ensured that Digital Signature was applied with
latest certificate to XLSM templates of Excel 2007. However for some reason, it
had no effect on macro security warning. When templates were deployed and
checked with web application which invoke and generate the report based on that
XLSM template, we found that security warning appearing at the top. We
rechecked the Digital Signature on those reports and surprisingly it had latest
certificate. We couldn’t understand why this problem is occurring though we put
latest Digital Signature correctly on template file.
Someone suggested that they had similar issue and their issue was
related to sorting of cells. We tried to remove such code where sorting of
cells was used.
ActiveWorkbook.Worksheets("XYZ").Sort.SortFields.add Key:=Range("AJ2"), _
SortOn:=xlSortOnValues,
Order:=xlAscending, DataOption:=xlSortNormal
If Sheet2.Range("Test").count > 0 Then
With ActiveWorkbook.Worksheets("XYZ").Sort
.SetRange Range("AJ2:AJ3")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
However removing such code as mentioned above didn’t helped to fix
the issue.
Finally we tried to explore referenced and unreferenced named
ranges. We tried to remove unreferenced named range one by one and then reapply
the digital signature on the template. Luckily we found that one of the defined
named range which was not used anywhere was having some relation with this
issue. Since that named range was not needed, we deleted it from named range
list. As soon as it was removed and digital signature was reapplied, macro
security warning was gone. Everything worked fine!!
Thanks For sharing Digital Signature Related Story
ReplyDelete