how to run a long VBA macro with multiple opned workbooks : I got a use case which I can't figure out a solution to implement and handle it.

My application (first workbook file) code processes a long file. It takes a longtime (say 15 min) and bore the user to wait for the end. The user switches to another workbook (second workbook file) while the process is running.

When the process ends, the application uses a reference to a sheet in the first workbook and miserably fails. How can I handle this situation without hard coding the first file name? 