Attached are 5 commonly used Macros. Many of our customers find these Macros handy to manipulate data in a certain way. They utilize a feature in the application call "Sub OSR_ReportComplete()" which allows for a macro to run after data has been populated, saving the user valuable time when running and editing reports.
|4x||Cloud & Private Host||Comment|
|Report Templates||Not Supported||Limited Support||Works with Open in Excel|
|Input Templates||Not Supported||Limited Support||Works with Open in Excel|
|Archive||Not Available||Not Supported|
|Publisher||Supported||Not Supported||See note below.|
The attached macros are:
- Page Break – Adds page break where specified by a user.
- Hide 0 Rows – Hides rows whose values are 0. Sometimes unchecking “Display Blank Records” doesn’t work.
- Macro to hide blank tabs – This works to remove tabs with no data when using “Sheet per Value”. There is no built in feature to suppress tabs with no data.
- Concatenation Custom Function – adding the custom function will allow you to use the “=Concat(Cell_Range, separator)” function in Excel where the values with in the cell range will be concatenated together. See below image for example. If the “separator” is omitted, it will use a space between the values in each cell.
- Hide 0 Columns - Hides columns whose values are 0.
Note (For 4x Publisher)
- If you plan on using Publisher to distribute your reports, you will need to add a delay trigger to the macro. The code is Application.Wait (Now + TimeValue("0:01:00")). The TimeValue should be determined by running the report in Excel and then adding 30 seconds to the final rendering time. A sample of the code could be:
Application.Wait (Now + TimeValue("0:01:00"))
To view these macros, open one of the files and click Alt+F11 (or click VBA editor from the Developer ribbon).
To add the macros in these reports to your own, go through the steps below.
1. Save your report as an Excel macro-enabled workbook
a. Select File and Save As
b. Choose the location you want to save your file
c. Fill out File Name
d. Hit the drop down for Save as type and choose Excel macro-enabled workbook
e. Select Save
2. Add the Developer tab in Excel if it does not already show up.
a. Select File
b. Select Options
c. Choose Customize Ribbon
d. Hit the drop down for Choose commands from and select Main Tabs
e. Highlight Developer and hit Add
f. Select OK
3. Add the Macro
a. Open the report with the Solver macro along with your other report
b. Choose the Developer tab on the report with the preexisting macro
c. Hit the Macros option
d. Highlight the macro you want to add to your report and hit Edit
e. Copy the entire macro text
f. Expand on VBAProject and Microsoft Excel Objects for your report
g. Double click on ThisWorkbook and paste the macro text in the box
h. Hit the save icon and close out of the macro editor
Every macro with have a short set of directions on how to get it to work for your report.
After you have completed these steps the macro will be executed after you run your report.