Skip to content

Batch Print

Loop over a number range (e.g. 1..100). On each iteration:

  1. Write the number into a driver cell.
  2. Excel recalculates the dependent table.
  3. Print or export PDF for the selected sheets.
  4. (Optional) Merge all PDFs into a single final file.

Typical use case: print 100 acceptance reports for 100 work items, or export 50 payslips for 50 employees — the template sheet is wired so changing the driver cell shifts all dependent values.

Open the dialog

DVD Addin → group File and Print → click split-button Batch Print.

Configuration

Number range

OptionDescription
Continuous (Start–End)Loop from N to M (e.g. 1 → 100).
Discrete (1+3+5)List separated by + (e.g. 5+8+12+20).

Driver cell (number)

The Excel cell that gets the loop number on each iteration.

Syntax:

  • DATA!$B$9 — cell B9 on sheet DATA.
  • 'Sheet One'!A1 — sheet name with spaces.
  • B9 — relative to whichever sheet is active when you open the dialog.

Click the arrow icon next to the box to pick the cell visually in Excel.

Sheet-print cell

A cell whose value lists the sheet names to print, separated by +:

Example value in DATA!$B$8: YCNTCV+BBNTCV+KT_DD

→ On each loop iteration, all three sheets are printed/PDF'd together (multi-select before sending PrintOut/ExportPDF).

Filename cell (PDF only)

Cell that yields the PDF filename for the current iteration.

Example DATA!$T$9: BBNTCV_DD-05_2026-05-15

→ Output file: BBNTCV_DD-05_2026-05-15.pdf.

Invalid filename characters (\/:*?"<>|) are auto-replaced with _.

Copies (Print mode only)

Number of copies per iteration. Default 1.

Options

Auto refresh AutoFilter between iterations

When the driver cell changes, AutoFilter may not refresh by itself, causing wrong rows to display. Tick to force AutoFilter.ApplyFilter() each iteration.

Auto-fit row height of merged cells

After the driver cell changes, text may be longer than current row height. Tick to run MergeAutoFit for ranges configured in Mucluc!B5:D104 (column C lists autofit ranges).

Auto-insert page break at signature row

Auto-insert a manual page break above the row configured in Mucluc!D{row} (column D = "Bottom-of-page break row"). Ensures the signature block doesn't get squeezed at the bottom.

Smart behavior (2026-05): only inserts the manual break IF Excel's natural automatic break is currently below the configured row. If the auto break is already at/above → does NOT insert → avoids producing an empty extra page.

Merge all PDFs into one final file (Export PDF only)

After all iterations finish:

  1. All per-iteration PDFs go to a temp folder.
  2. PdfSharp merges them in generation order (NOT alpha-sorted by filename — so iteration 52 stays before 53 even if their filenames sort the other way).
  3. Saves to the path you picked in the Save As dialog.
  4. Cleans up the temp folder.

Time format

Dropdown picks a format for the {date} template variable: dd/MM/yyyy (default), yyyy-MM-dd, MM-yyyy, etc.

Save settings

Click Save settings — config is stored in a hidden sheet DVDAddinSetting of the current workbook. The next time you open the dialog from this workbook, it auto-loads.

Typical workflow

Setup the workbook (one-time)

  1. Create sheet DATA with:
    • B9 — the driver number (e.g. work item index).
    • B8 — the sheets to print (e.g. YCNTCV+BBNTCV+KT_DD).
    • T9 — PDF filename (formula =CONCATENATE(...) or literal).
  2. Create the template sheets (YCNTCV, BBNTCV, KT_DD, ...) with INDEX/MATCH or VLOOKUP formulas reading from DATA!B9.
  3. Create a Mucluc sheet (if needed for autofit/page break config) with:
    • Column B (rows 5..104) = sheet name.
    • Column C = autofit ranges (A4:F50+A60:F80).
    • Column D = "Bottom-of-page break row" (integer).

Run

  1. Open the configured workbook.
  2. Open the Batch Print dialog.
  3. Configure range + 3 RefEdit fields (Driver/Sheet/Filename) + options.
  4. Click Export PDF (PDF) or Print (printer).
  5. Excel status bar shows progress: DVD Addin: Export PDF 5/100 (number 5)....
  6. On completion, popup shows a summary: iterations, PDFs/prints generated, errors, per-phase timing.

Phase timing report

The completion popup includes a timing breakdown:

⏱ Total: 45.12s
  • Write driver cell:     1.23s (3%)
  • Calculate:             8.45s (19%)
  • AutoFilter:            0.12s (0%)
  • Resolve+Select sheet:  2.34s (5%)
  • Auto-fit merge:        4.56s (10%)
      ↳ Pass1 baseline:    1.23s
      ↳ Pass2 per-merge:   2.34s (45 merges)
      ↳ Pass3 apply:       0.99s
  • Export PDF|Print:      28.4s (63%)
  • PDF merge (PdfSharp):  0.5s (1%)

Use it to find the bottleneck:

  • Calculate > 30% → workbook has heavy formulas — reduce volatile/array formulas.
  • Auto-fit merge > 20% → reduce range count in Mucluc!C.
  • Export > 70% → normal, hard to optimize further (Excel/PrintCommunication already disabled internally).

Troubleshooting

"No workbook is open"

Open any workbook before running the command.

"No numbers to iterate"

Empty range (Start > End, or Discrete empty). Re-check.

Workbook closes mid-run / Excel crashes

Likely a Worksheet_Change VBA handler in the workbook creates an infinite loop when the driver cell changes. Disable events in your VBA temporarily, or detach the template into a fresh workbook with no VBA.

EnableEvents

Batch Print intentionally keeps EnableEvents = ON and Interactive = ON during the loop. Reason: many real-world workbooks (e.g. FormNTCV.xlsx) rely on Worksheet_Change to propagate the driver cell to dependent tables. Suppressing events would make every iteration export the same data as iteration 1.

Merged PDF is out of order

SHOULD NOT happen on 2.7.7+ — PdfSharp merges in iteration order, not alpha filename. If it still occurs, file a bug.

"RPC_E_WRONG_THREAD" / Excel COM error

Another VBA macro may be running. Close all macros → restart Excel → retry.

Released under DVDAddin License.