Run time Error 91 after Application Quit

Stephen W Allen

New Member
Joined
Jul 21, 2021
Messages
20
Office Version
  1. 2019
Platform
  1. Windows
I have created an Add-In downloadable over the internet. This Add-In is designed to copy itself to a User's "Microsoft/AddIns" folder and Set Installed = True. The oginal / parent Add-In then quits Excel to allow the copied version to take over functionality.

The code generates a Run time error of 91 AFTER Application.Quit has been activated. All other aspects of the process complete as expected. I cannot get a handle on the error to see what is causing it.

Any Advice?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
As obviously Application.Quit must be the last codeline executed …​
 
Upvote 0
As obviously Application.Quit must be the last codeline executed …​
That is not true in all circumstances.

For example, if you quit Excel with an unsaved workbook open, it will ask you if you want to save it. In this case the answer is 'No'.

Would it help if I provided the final If statements of the Sub routine?
 
Upvote 0
Give it a try with Quit as last codeline …​
 
Upvote 0
Solution
I'm sorry, I should have posted the code.

There were alternative paths to the
VBA Code:
Application.Quit
statement: one where a
VBA Code:
Workbook.Close Save:=FALSE
was needed and the other where there was no Workbook to close.

In fact my code tried to close the Workbook in both cases. That's what generated the error.

Problem now soved
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top