PDF Preview Broken After Windows Update: Fix
Fix pdf preview not working after windows update with safe checks for File Explorer, Outlook, PDF handlers, file permissions, Office workflows, and automation.

If VBA stops with “Run-time error 9: Subscript out of range,” the macro requested an item that does not exist in an array, workbook, worksheet, or collection. The most common cause is a worksheet or workbook name in the code that does not exactly match the name available at runtime; vba error 9 subscript out of range is a reference mismatch, not usually an Excel installation problem.
VBA resolves an index or key against the items that actually exist at that moment. If the requested position or name is missing, it cannot return an object or value and raises error 9.
Use the table to narrow down the first check:
| Likely cause | Typical symptom | Quick test |
|---|---|---|
| Worksheet name mismatch | Error on a Sheets or Worksheets line | Compare the quoted name with the visible sheet tab |
| Wrong workbook reference | Code works only when a particular file is open | Inspect Workbooks in the Immediate window |
| Array bounds mismatch | Error on an array element such as values(i) | Check LBound and UBound before indexing |
| Collection index does not exist | Error on an indexed item in a loop | Check the collection's Count and loop limits |
When the error dialog appears, choose Debug. The VBA editor highlights the statement that failed. Identify the expression inside brackets or after a collection name, such as Worksheets("Data"), Workbooks("Report.xlsx"), or items(i). If the dialog is gone, run the macro again from the editor with F5 and choose Debug when prompted. The highlighted statement tells you which reference to inspect first.
In Excel, compare the sheet tab text with every name used in the failing line. Spaces, punctuation, and renamed tabs matter. For example, Worksheets("Sales Data") will fail if the actual tab is named Sales. Check that the macro is using the intended workbook too: qualify the reference, such as ThisWorkbook.Worksheets("Sales"), when the sheet belongs to the file containing the macro. The fix is confirmed when the line runs without error and targets the intended sheet.
For a reference such as Workbooks("Report.xlsx"), check the open workbook's displayed name in Excel. The name must match, including the extension when one is used in the code. In the VBA editor, press Ctrl+G to open the Immediate window and run ? Workbooks.Count; list open workbook names with a short loop or inspect the Excel window. If the file is not open, open it first or change the macro to open the correct path. Confirm the expected workbook object is found before accessing its sheets.
At the highlighted array access, inspect where the array is declared or populated. Use LBound(arrayName) and UBound(arrayName) to find its valid index range; do not assume every array starts at zero or one. For a loop, use those bounds instead of a hard-coded range, and check that the array was initialized before reading it. If it is a dynamic array, confirm the code called ReDim before indexing. The fix is confirmed when the requested index falls within the reported bounds.
For a collection such as Worksheets or Workbooks, check its Count and the loop's starting and ending values. A collection indexed from 1 through Count will fail if the loop goes one item too far. Use For i = 1 To Worksheets.Count when iterating through Excel worksheets, and avoid reusing a count captured before the collection changes. Run the loop again; it should visit each existing item without requesting an extra one.
When Excel, Word, or Outlook is automated from another Office host, an unqualified reference may point to the active document or workbook rather than the one your code expects. Use an explicit object variable and qualify child objects, for example Set wb = Workbooks.Open(filePath) followed by wb.Worksheets("Data"). In Word, check the intended Documents collection item; in Outlook, confirm the item is in the folder or collection being searched. The fix is confirmed when the code consistently accesses the selected object, even if another document or workbook is active.
Power Query refreshes, PDF exports, and other automation can change which sheets, rows, or files exist. If the macro expects an imported sheet or a PDF-derived output name, check the result after refresh or export before looking it up. Inspect the workbook's sheet tabs and the exact generated filename, then adjust the code or ensure the preceding step completed successfully. The reference should resolve after the expected output exists.
Choose Debug and inspect the highlighted line. Compare the requested worksheet or workbook name with the actual open item, or check the index against the array or collection bounds. Correct the mismatch and run the macro again.
The workbook, worksheet, or generated file names may differ, or a required workbook may not be open on the other computer. Check the exact names and qualify references to the intended workbook. Also confirm that any imported data or output files were created before the macro accesses them.
Yes. Requesting a worksheet by a name that is not present in the referenced workbook raises this error. Check the tab name and the workbook object used by the code, including whether the sheet was renamed or never created.
Run the macro again after correcting the missing name, invalid index, or wrong object reference, and confirm it reaches the intended item. If the error remains, use Debug to identify the next failing line and inspect the actual names and bounds at that point.
Photo: Aleks Dorohovich aleksdorohovich / CC0 (Wikimedia Commons)
Fix pdf preview not working after windows update with safe checks for File Explorer, Outlook, PDF handlers, file permissions, Office workflows, and automation.
Mail merge not working with new Outlook? Learn why classic Outlook matters and use Word, Excel, PDF, or Power Automate alternatives to send documents today.
Google Sheets keeps scrolling to the right? Find out how frozen columns, hidden columns, browser zoom, and trackpad gestures cause it, then fix the view.
Google Sheets keeps changing date format? Fix spreadsheet locale, import settings, and formulas so dates stay consistent across Sheets, Excel, Power Query, and PDF exports.
Power query stuck on preview is evaluating? Find the cause, stop long-running previews, and fix Excel Power Query with practical checks you can do today.
Fix excel power query stuck on loading data by checking privacy levels, isolating slow sources, and reviewing refresh settings with these practical steps.
Fix vba error 9 subscript out of range in Excel and Office macros by checking workbook, worksheet, array, and collection references with practical tests.
Fix pdf error 108 startxref missing or invalid by checking the file source, repairing a copy, and restoring PDFs safely in Excel, Word, Outlook, and automation.
Excel removes leading zeros because it treats codes as numbers. Fix imports, formats, and formulas to keep IDs, ZIP codes, and account numbers intact in every workflow.
Excel keeps changing last digit to 0? Learn why 16-digit values lose precision and how to preserve IDs in Excel, Power Query, Word, Outlook, and PDFs.