Adding a Macro to nVision Layouts to Force Recalculation of All Cells when the Report is Run
The quick workaround is to force recalculation of all cells. Excel is efficient with resources when it recalculates a spreadsheet and only recalculates those cells that it recognizes as having changed since they were last recalculated. This issue arises because Excel isn't identifying some cells that need to be recalculated. Typing F9 (recalculate) doesn't work, However, typing Alt+Ctrl+Shift+F9 will force Excel to recalculate all cells, even those it thinks don't need to be recalculated.
An option for layouts that have been identified with this issue is to add a macro that performs the above keystrokes, and then call that macro using an nVision instance hook.
Here are the steps to do that.
Recording a Macro and Adding an nVision Instance Hook
- Open layout
- From the Developer ribbon, click Record Macro
- Name the macro something simple and descriptive and store in “This Workbook”. Click OK.
Establish NvsInstanceHook
Saving the layout as a macro enabled workbook
Since Excel 2007, Excel files which have macros associated
with them must be explicitly identified by the .xlsm file
extension. So we now need to identify this file as one that
contains a macro, otherwise we will experience an error
when we run the report.
-
When saving you will be presented with the following dialog box. Click No.
- Save the layout as a .xlsm file
- Close the .xlsm file
- Using Windows Explorer confirm you now have two files with the same name, but one is the .xnv file, and the other is the .xlsm file. Delete the original .xnv file from the layout folder and then Change the .xlsm file to .xnv
- Accept the warning when you change the file extension