Excel crashes when opening file - maybe macros issue

leojez

Board Regular
Joined
Apr 12, 2022
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Hello,

An excel file I've been working on has suddenly started crashing every time I open it. It could be a dud macro, not sure. The problem is I can't get it open to check. I've tried the following:

1. Open your file within Excel: Menu > File > Open > Recent Workbooks and hold down the Shift key when clicking on the file name.
--> This doesn't work, it still shuts down instantly

2. The steps in this post: Excel Crashes When Opening Trusted Document With Macros Or Enabling Macros
--> Again, this doesn't work, it still shuts down instantly

3. Opening the file in Protected View.
--> This opens the file and it stays open. However, as soon as I click on "Enable Editing" it shuts down again.

It's a lot of work to loose so I can very concerned. Is there anyone who can help, please?

Thanks!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You can try this...
First open task manager and close all opened excel documens.
Then try to open your file again.
If this do not help you, open new workbook and in the VBA editor insert this code...
VBA Code:
Sub OpenFileWithVBA()

    Application.FindFile
    
End Sub
Run this code with debugger line by line...
Navigate to the problematic file and try to open it.
If you see your project in the VBA editor "Project Explorer" window your problematic file is opened.
Select your project and go to the This Workbook =>Workbook_Open event and try to find problematic code line
step by step.
 
Upvote 0
You can try this...
First open task manager and close all opened excel documens.
Then try to open your file again.
If this do not help you, open new workbook and in the VBA editor insert this code...
VBA Code:
Sub OpenFileWithVBA()

    Application.FindFile
   
End Sub
Run this code with debugger line by line...
Navigate to the problematic file and try to open it.
If you see your project in the VBA editor "Project Explorer" window your problematic file is opened.
Select your project and go to the This Workbook =>Workbook_Open event and try to find problematic code line
step by step.
Thanks for the idea! Just tried it, but again it closed on running the debugger :(
 
Upvote 0
Do not run debugger with "F5" but with "F8"(line by line).
 
Upvote 0
Do not run debugger with "F5" but with "F8"(line by line).
Sorry, not quite understanding (I'm new at this) ...

This is what I'm doing - opening Developer -> Visual Basic
Insert -> Module
Copy/paste your code
Then tried F8 ... it allowed me to open the file but then it closed down right away.

I'm probably doing something wrong.
 
Upvote 0
Do you see problematic project in the project explorer window after you open file with code?
If you don't see project explorer press Ctrl + R and look to the left panel.
 
Upvote 0
Do you see problematic project in the project explorer window after you open file with code?
If you don't see project explorer press Ctrl + R and look to the left panel.
Yes, I see them there for the second or two before the whole app crashes and closes. The app won't stay open long enough to do anything.
 
Upvote 0
Try this...
Close all Excel application in the task manager.
Press Ctrl + Shift and click on the problematic file to open it.
The file should be opened in the task bar.
Click "Yes" button on the message box and open file in the safe mode.
Now go to the VBA editor => ThisWorkbook => Workbook_Open event and try to find problematic line.
Delete it and save workbook with new file name.
Try to use this new file.
If problem is not resolved try to do this few times until you find real problematic line.
 
Upvote 0
Try this...
Close all Excel application in the task manager.
Press Ctrl + Shift and click on the problematic file to open it.
The file should be opened in the task bar.
Click "Yes" button on the message box and open file in the safe mode.
Now go to the VBA editor => ThisWorkbook => Workbook_Open event and try to find problematic line.
Delete it and save workbook with new file name.
Try to use this new file.
If problem is not resolved try to do this few times until you find real problematic line.
Thanks for helping me out so far! I got as far as "Click "Yes" button on the message box and open file in the safe mode." Then The file opened and then Excel shut down completely. :(
 
Upvote 0
Let's try first option again.
Close all Excel applications in the task manager.
Open new workbook and in the VBA editor insert this code in the new module...
VBA Code:
Sub OpenFileWithVBA()

    Application.FindFile
  
End Sub
Run this code line by line with keyboard key "F8".
Find your problematic file, select it and press button "Open".
If message box "Want to save your changes?" appear press button "Cancel".
Now you should have two opened Excel files.
Close first file but do not close file with problematic code.
Go to the VBA Editor => ThisWorkbook => Workbook_Open event and again with "F8" key check line by line looking for the problematic line.
When you find it, change it and save Workbook.
Close workbook. Open it. Now should works.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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