Userform throws runtime error 91 when file opened by double-clicking file name but not when opening file using recent histiry from task bar

William Thomas 0 Reputation points
2024-08-03T14:07:10.7233333+00:00

I have a file that was uses a common Userform for list selections. If I open the file by going to the folder where it resides and double-click the file name, the Userform code throws runtime error 91 when it reaches a line of code involving the ListBox on the form. The debugger shows the ListBox as 'Nothing' when I put it in the watch window. However, if I open the exact same file from the task bar Excel recent history, it works as intended.

The errors only occur on a computer running Office 365. If I run the exact same code on a computer running Excel 2013, it runs as intended regardless of how I open the file.

What is going on and how do I get the correct behavior by double-clicking the file name?

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,644 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,904 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,915 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.