WORKSHEET CLOSE NOTICE

N

Nny :\)

Greetings. I have a VBA application that opens text
files, formats them into worksheets, saves them as Excel
documents and uses Outlook to email them out.

There is a problem with my worksheets, though. When the
user is modifying the worksheet (this is the resulting
worksheet from importing the text file) they are able to
close the worksheet. This causes a problem because the
application expects the worksheet to be there and will
crash if it is not.

Is there anyway to disable the user's ability to close
WORKSHEETS (not workbooks) using the Close Button [X] on
the upper right side of the worksheet? I can't find any
events to go with closing a worksheet...I can only find
events for pertaining to workbooks.

Please Help!

Nny :)
 
D

Dave Peterson

Not that I know of.

But you could have your application look for the worksheet first and yell if it
isn't found:

dim testWks as worksheet
.....

set testwks = nothing
on error resume next
set testwks = yourtextworksheethere
on error goto 0

if testwks is nothing then
msgbox "yell like heck!
exit sub '?????
else
'continue
end if

Nny :) said:
Greetings. I have a VBA application that opens text
files, formats them into worksheets, saves them as Excel
documents and uses Outlook to email them out.

There is a problem with my worksheets, though. When the
user is modifying the worksheet (this is the resulting
worksheet from importing the text file) they are able to
close the worksheet. This causes a problem because the
application expects the worksheet to be there and will
crash if it is not.

Is there anyway to disable the user's ability to close
WORKSHEETS (not workbooks) using the Close Button [X] on
the upper right side of the worksheet? I can't find any
events to go with closing a worksheet...I can only find
events for pertaining to workbooks.

Please Help!

Nny :)
 
Top