Signing nVision Macros
If you have to support nVision reports, you’ve probably had to deal with getting nVision configured on developer workstations. To develop nVision reports, you need to run Excel macros inside Excel. But, many organizations are concerned about allowing users to run any macro. Macros are often an attack vector for hackers, so running Excel macros are something that IT security often discourages.
How do we balance the need to run nVision and IT security discouraging macros? We can sign the nVision macros with a certificate from your organization so that the macros are trusted. To sign the macros, we will use tools that come with Microsoft Office.
Generate a Certificate
First, we need to generate a certificate. If you have Office 2016, you will find the
selfcert.exe program here:
C:\Program Files\Microsoft Office\root\Office16\
PS C:\> cd 'C:\Program Files\Microsoft Office\root\Office16'
PS C:\Program Files\Microsoft Office\root\Office16> .\SELFCERT.EXE
Give your certificate a name,
nVision, and click OK. Your certificate is stored in the Windows Certificate Manager.
Sign the Excel Macro
Next, launch nVision and sign in. If nVision hangs, you can start Excel, set the macro settings to “All Macros enabled” for now (File> Options > Trust Center > Trust Center Settings > Macro Settings), then relaunch nVision.
Once nVision has started, enable the Developer tab under File > Options > Customize Ribbon. Select the Developer option and move it to the toolbar. Next, click on Developer tab and select the Visual Basic button. In the VB Editor, click on Tools > Digital Signature and select the
nVision certificate. Save your changes.
Test the Signed Macros
Before we test, make sure your Excel macro settings are correct. Under File> Options > Trust Center > Trust Center Settings > Macro Settings, select the option “Disable all macros except digitally signed macros”. Close Excel and nVision.
Last, launch nVision and watch your digitally signed macros run in Excel.