WORKSHEET CLOSE NOTICE

  • Thread starter Thread starter Nny :\)
  • Start date Start date
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 :)
 
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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top