Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel closes immediately upon opening this file 5

Status
Not open for further replies.

JVFriederick

IS-IT--Management
Mar 19, 2001
517
US
I have an Excel 97 file that refuses to open. In fact, during opening the file, it closes out of Excel completely.

I tried disabling macros, opening in Excel 2K, but nothing seems to work.

The file is ~235K and seemed to save normally last night. I have no idea of anything I may have done to cause this.

I was writing VB code, and would be very happy if I could just get the code saved to another location so I can continue where I left off.

Thanks.
 
Don't know if I can help, but I'll certainly try ...

LittleRedHat@btinternet.com

 
LRH has been helping solve this problem.
I will post a solution here if one is found.
So far, no luck.
 
This may be way off - but once I had a file that did the same thing. I went into tools, options and changed to manual calculation, then I was able to open the file. If I attempted to calculate it using F9, the file would immediately close. I did end up having to re-create that worksheet, but I was able to copy and paste most of my data.

Good luck!

Danhauer
 
Hi JVFriederick ,

...Just another "shot in the dark"...

If you have been running Excel with "Macro Virus Protection" disabled, what about trying enabling of:

Tools Options General ...Macro Virus Protection

Then, perhaps you could then get into the worksheet, to modify the (possible) "runaway code", and/or recover your data.

You've probably already tried this, but if not, perhaps it's worht a try.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Danhauer - I noticed the F9 advice from MS, but it doesn't help.
Dale - Turning on macro virus protection doesn't help.

This problem arose from using the same PC I use everyday doing the same type of work I do everyday. I'm ... puzzled. (there are other words I can think of but I'll stick with puzzled)

 
This code lists all the VB objects in the current workbook

Private Sub Test()

Dim x As Object
Dim i As Integer
For i = 1 To Application.VBE.ActiveVBProject.VBComponents.Count
MsgBox Application.VBE.ActiveVBProject.VBComponents(i).Name
Next i
End Sub


So....

(I haven't tried this, by the way)

Let's see if we can make reference to your "Bad" workbook & delete all the code in it.

Private Sub DeleteCode()
Dim objExcel As Excel.Application
Set objExcel = GetObject("C:\YourName", Excel.Application)
For i = 1 To Application.VBE.ActiveVBProject.VBComponents.Count
Set x = Application.VBE.ActiveVBProject.VBComponents(i)
x.Remove VBComponent:=x.Item(i)
Next i
End Sub

Lset me know if this helps. Tyrone Lumley
augerinn@gte.net
 
Databaseguy - I tried the second part to your help.
I made a copy of my file in C:\Temp\Tank.xls and tried
Set objExcel = GetObject("C:\Temp\Tank", Excel.Application)
and
Set objExcel = GetObject("C:\Temp\Tank.xls", Excel.Application)

When running the complete code from another file, I get :
Run-time error 429
ActiveX component can't create object

I'm sending the file on your way.

Thanks, Jim


 
JVFriederick:

This sounds intriguing, could you possibly send me a copy as well? It's sometimes better to have two heads (or more) working from different angles than to have just one head with tunnel vision to a dead end.

--MiggyD

miggyd2000@yahoo.com "The world shrinks more and more with every new user online."
 
Got it, thanks.

I've been able to access the worksheet unfortunately the formulas were not transferred. I'm sending you what I was able to do. Hopefully, it helps you out.

--MiggyD It's better to have two heads to solve a problem for different angles than to have tunnel vision to a dead end.
 
Thanks to all for the effort. Unfortunately, I still have been unable to recapture the lost VB code. (The data within the spreadsheet can be obtained from a backup copy).

Time to start over with the backup copy. B-(

Thanks again.

Just one of those things. At least next time I'll know to start over sooner !!!


 
I was real close using the DDE syntax, but it's not well documented and I don't know the "object model". Funny thing is, you can access the tables using the import function without opening the dicument, so it would make sense that you could get to the code also.

Hmmm..... Tyrone Lumley
augerinn@gte.net
 
Yeah, I though so too. But, the closest I got was...to see that there were no less than 8 macros in this file.

After a binary to ascii breakdown, I could only read some saved "REM"arks which I sent back. The other thing I found was that macros #2 throught #8 were duplicated (as is normal with excel files); however macro #1 wasn't replicated [which is where I believe lies the problem]

I had changed the macro 1 name [that I could read] and tried again, only to have an error stating something like:

"the macro name is too long...it will be turnicated...blah, blah, blah..."

and excel would run mac1 only to exit excel. If it wasn't for a project I have at work, I'd probably had spent more time than I did. But, it was a nice diversion from the mind-numbing straight coding I'm doing.

Good luck with coding it, JVFriederick.
--MiggyD It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
 
If you called the file by creating an instance of Excel through VB, some of Excel could still be running as a process. Check TaskManager\Processes for Excel.exe
 
Twas not the case. Chalk it up to "one of those things."
The file has been rebuilt now.

Thanks to all who helped and were frustrated by the Excel scramble.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top