View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Opening a file with macros lead Excel to crash

I think by the time the macro starts running, the complete file (with all its
worksheets) is open.

Any chance that the Setup sheet is hidden or even deleted, so that the .select
can't work?

And when you write crash, do you mean that the application crashes or that one
line causes an error.

If it's just the one line...

I've seen posts that say that excel can get "confused" while starting up. Some
pretty smart people have recommended this kind of thing.

Sub Auto_Open()
Application.OnTime Now, "Continue_Open"
End Sub

Then in a general module:

sub Continue_Open()
'your real code here
end sub

Maybe this'll avoid any "timing" issues that excel is having??????

Good luck.

If it's the application that's crashing, maybe it's time to recreate the
workbook. Maybe that workbook is corrupt and needs to be rebuilt.

Another option...

Maybe running Rob Bovey's code cleaner would help:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm

JorgeLMV wrote:

Hi,

From time to time when I open one file enabling the macros leads Excel to
crash and whether I save the file first disabling the macros the problem is
solved. Some other times excel doen's crash but it stop in one instruction
like
sheets("Setup").select this instruction is located in the workbook open
even and I think at that time Excel has not opened all the sheets and it's
not able to find it, but why it's only some times.

Any clue?, I appreciate any comment

--
Regards
Jorge Mendoza V


--

Dave Peterson