Some customers still rely on Excel-based forms to generate reports or certificates and want to continue using that workflow in Quality Window.
Quality Window now includes Report Documents for structured reporting, but this legacy macro provides an alternative for customers who prefer working with Excel templates. It allows you to pull data directly from Quality Window, populate an existing Excel form, and generate a finished document.
This script was previously included as part of the product and is now provided as an optional download for customers who want to continue using this Excel-based approach.
Download
Download the legacy Excel form macro
For instructions on how to install this macro, see: How to deploy custom scripts in Quality Window
How this macro works
This macro links a Quality Window application to an Excel file and replaces placeholders in the sheet with live data.
When executed, the macro:
- Opens the selected Excel file
- Scans the active worksheet for tokens
- Replaces each token with data from Quality Window
- Outputs a completed document (typically saved as PDF)
This follows the same approach used in earlier Certificate of Analysis workflows.
Designing your Excel form
Start by creating an Excel file that represents your final report layout.
This can include:
- Logos and formatting
- Tables and headers
- Signature areas
- Any static text required
Wherever you want Quality Window data to appear, insert tokens directly into cells.
This is the core concept: the Excel file acts as a template, and the macro fills in the data.
Supported tokens
The macro replaces tokens using a structured format.
Prompt values
Prompt[Customer Name]
- Prompts the user at runtime
- Reuses the same value if repeated
- Useful for customer names, lot references, notes
This behaves the same as the legacy COA workflow where prompts are entered once and reused throughout the document
Variable values
Value[Batch_No]Value[pH]
- Pulls values from the current record
- Variable name must match exactly
- Variable must exist in the current view
The macro uses the active record in the logsheet when resolving values
Statistics
Avg[pH]Cpk[pH]
- Uses statistics available in the current view
- Must use standard Quality Window abbreviations
Examples include Avg, N, USL, LSL, Cpk, Tz, etc
System values
System[UserName]System[QWFilename]System[DATE:yyyy-mm-dd]
Supported values include:
- Date and time (with formatting)
- Application name
- View name
- User name
- Computer name
These allow reports to include traceability and metadata automatically
Special commands
$SUMMARY
Placing $SUMMARY in a cell generates a summary section.
The macro will:
- List variables from the current view
- Output selected statistics
- Respect view settings such as “chartable variables only”
This is a fast way to generate a full statistical table without manually defining each field
File naming and selection
The macro attempts to locate the Excel file automatically.
- If no view is loaded → looks for a file matching the application name
- If a view is loaded → looks for a file matching the view name
Supported file types:
.xltx,.xltm,.xlt.xlsx,.xlsm,.xls
If no match is found, the user is prompted to select a file.
This allows you to:
- Use one standard template per application
- Or use different templates per view
How users run the macro
Once installed, the macro appears in the Macros menu.
Typical workflow:
- Open the Quality Window application
- Load a view if filtering is required
- Select a record if using Value tokens
- Run the macro from the Macros menu
- Review or save the generated document
The macro processes tokens from top to bottom and fills the Excel sheet accordingly
When to use this approach
This macro is a good fit when:
- You already have Excel-based report templates
- You need full control over layout and formatting
- You want to combine prompts with data
- You need a simple document generation workflow
Important notes
- Variable names in Excel must match exactly with Quality Window
- Variables must be included in the active view
- A valid record must exist when running the macro
- The active worksheet is used during processing