How to detect / bypass the Workbook Recovery window and process

jjasmith4

New Member
Joined
Aug 22, 2018
Messages
48
I'm working with a Word/VBA system, and as it goes, it opens an XLSX to get some information from it. One of many users reported that nothing came from the XLSX, so I manually opened Excel to open the file which the code should have opened, just to prove it wasn't a permissions / access issue.

What happened was that, when I double-clicked the XLSX, Excel opened, and the Recovery window came up, the one that tells you about unsaved documents following an abnormal crash. No other user had that, so it worked fine for the rest. And once I dismissed all the recovered files, closed Excel, and re-ran my Word/VBA system, it worked.

So somehow the presence of unsaved stuff following a crash is what prevents VBA code from opening any workbook. How in VBA can I create a new Excel application object (OK, I can do that) and successfully open a workbook in it without that recovery stuff getting in its way?

Thanks in advance.
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,660
Add some error code so that when XL errors it doesn't crash. HTH. Dave
 

jjasmith4

New Member
Joined
Aug 22, 2018
Messages
48
Not exactly an answer. My system is a Word DOCM. When it starts, it starts Excel by creating a new application object. So whatever the user has done in Excel has happened before my system even starts. So even before creating the object, how can I know Excel's recovery pane will come up and interfere?
 

jjasmith4

New Member
Joined
Aug 22, 2018
Messages
48

ADVERTISEMENT

Thanks, Paul Ked, I saw that, and after reading through it, I don't like it. It seems really clumsy and unusual for regular users to put up with, and I think I'll hear about it from many of them.

I did find out about %LOCALAPPDATA%\Microsoft\Office\UnsavedFiles, so I'm going to give that a try...
 
Last edited:

Paul Ked

Active Member
Joined
Jun 4, 2015
Messages
442
Good luck, I'll keep an eye on this thread if you'd be kind enough to update. (y)
 

jjasmith4

New Member
Joined
Aug 22, 2018
Messages
48

ADVERTISEMENT

Will do, but feel free yourself! Next time Word, Excel or Powerpoint crashes, check out that folder
 

Paul Ked

Active Member
Joined
Jun 4, 2015
Messages
442
Just a thought, what if you delete all temp files that start with a tilde before opening excel?
 

jjasmith4

New Member
Joined
Aug 22, 2018
Messages
48
Oh believe me, I know about cleaning Temp, Content.MSO, tilde files, ATF Cleaner, CCleaner, Disk Cleanup, all that. They clean files, but they don't preven the Recovery dialog...
 

Watch MrExcel Video

Forum statistics

Threads
1,118,168
Messages
5,570,615
Members
412,333
Latest member
hectamuptra
Top