View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default Help with function that crashes Excel

A very long time ago - this was a major issue with my workbooks.

The kinds of things that were causing the problems
1. Public variables also Dim'd in separate macros
2. Module name and macro names being the same
3. Using names for variables that are also used by Excel (when in doubt I
use F1 to see if name
exists)
Sub Save()
Dim sheets as .....
and others that I don't remember.

Compiling the workbook helps find some of these.
You just need to search for any others...

You might also try the code cleaner at this site
http://www.appspro.com/Utilities/CodeCleaner.htm

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
I would check the file on your machine and remove any references that are
non-standard (create a new workbook on your machine and with it active in
the VBE, go to tools=References - that should show you what is standard).
Do the same with your troublesome workbook as the activeworkbook (selected
in the Project explorer).

Remove any differences.
Then save the file

This is just a guess, however.

--
Regards,
Tom Ogilvy

"Ken Loomis" wrote in message
...
When I send my workbook to someone to run, it bombs and crashes Excel. No
warnings, No Message. No nothing.

I used this Function from Chip Peasron to determine if a file exits:

Function SheetExists(sname As String, _
Optional ByVal wb As Workbook) As Boolean

MarkSub "SheetExists"

' Chip Pearson
On Error Resume Next
If wb Is Nothing Then Set wb = ThisWorkbook
SheetExists = CBool(Len(wb.Sheets(sname).Name))
End Function
============

I call that function with this if statement:

If Not SheetExists("Oldfiles", ActiveWorkbook) Then

=============


I do not really understand the "File Exists" function, but it works fine

on
my system.

Using a GetInfo routine I got from somewhere, I have been able to capture
the following information about the system where this crashes, if it

helps:

Application Name 10.0
Operating system Windows (32-bit) 4.90
Application Path C:\PROGRAM FILES\OFFICEXP\OFFICE10
Library Path C:\PROGRAM FILES\OFFICEXP\OFFICE10\LIBRARY


On my system, where the program works, that GetInfo routine captures
this:

Application Name 11.0
Operating system Windows (32-bit) NT 5.01
Application Path C:\Program Files\Microsoft Office\OFFICE11
Library Path C:\Program Files\Microsoft Office\OFFICE11\LIBRARY


Sorry for the bad formatting.



I hope I haven't provided too much information, but if you should need

more
please let me know.

Please help me figure this out.

TIA,
Ken Loomis