Excel VBA crashes when altering Dim statement

Nightspore68

New Member
Joined
Jan 26, 2012
Messages
12
This happens to me periodically, maybe twice a year: I realize I need my arrays to be bigger and when I alter the Dim statement, Excel crashes. At one point I was able to export the module, remove the module, and then import the module to fix the problem. But now I can't even remove the module without Excel crashing.

The funny thing is that I am able to add a comment line without trouble. But I can't mess with the declarations.

If history is any guide, it will work fine tomorrow when I get to work. Even though I've already tried a reboot today.

I'm using Office 2007 and Windows XP.

Wondering if anyone else has similar problems.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sounds like you have live code running... do you have any event type code running at the same time?

Perhaps load excel in safe mode:
Code:
"C:\Program Files\Microsoft Office\Office\Excel.exe" /s
 
Upvote 0
No, I don't have any event type coding running.

When I start Excel up in Safemode, I don't know how to get to the visual basic editor. I assume it's not available in safemode. I can't make any changes to my VBA outside of the VBA editor, can I?

thanks,
Michael
 
Upvote 0
Macro's still work in safe mode.

Alt+F11 will bring up the visual basic editor.

If all else fails there is also a settings file that can get corrupted from time to time in the user folders:

%appdata%\Microsoft\Excel\Excel14.xlb

Delete the xlb file, it will get recreated. I have seen this file grow and slow excel down quite a lot.
 
Upvote 0
%appdata%\Microsoft\Excel\Excel14.xlb

Delete the xlb file, it will get recreated. I have seen this file grow and slow excel down quite a lot.

Not trying to hijack, but does this only work in safe mode, or will it get re-created regardless? I assume it happens when you load excel next time...??
 
Upvote 0
This morning I went into Excel (normal mode) and had the same problem - crash when updating the Dim statement. So I went into safemode and got the VBA editor up with Alt-F11. Thanks for the tip, Ragnar! However, my modules were not present, presumably because of safemode? So I couldn't get to the troublemaking script. I guess I could import them... I'll try that in a bit.
Yesterday I did use Windows search to try to find .XLB files, but it didn't find any, even looking in system files (but not hidden files). This morning I looked in c:\Documents and Settings\myname\Application Data\Microsoft\Excel, but there were no XLB files. I even unchecked "hide protected operating system files" but no XLBs appeared.
Weird, huh?
I have been having other troubles with Excel that are probably related. For instance, it no longer closes gracefully and I have to force it shut, not with task manager, but with a warning window that pops up after a minute or two. This is all the time. The good news is I'm due for a computer upgrade soon. Hopefully these problems will vanish on the new machine.
Thanks for your help :). If you do think of anything else, please let me know and I'll give it a shot.
Michael
 
Upvote 0
Ooo, good news! In safe mode I was able to import my backup of the script in question AND alter the dim statement! I think I'm back in business!
Thank you:biggrin:
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,405
Members
449,157
Latest member
mytux

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