red "X" disable

P

pswanie

i want to try the code i got but will the "red X" be enabled/visible next
time i open a work sheet? its just for this one sheet that i need it not to
show.

http://groups.google.ca/group/micro...l+red+x+disable&rnum=1&hl=en#5bd264901943f109

or use Google Group search for: red x disable group:*excel*

the code that im looking at now are on that link..


i want to prevent ppl closing the workbook with the "X"

i got a button with a macro that saves, print and quit the workbook. and
another that just save and quit the workbook.

thanx
 
V

Vasant Nanavati

Please don't start a new thread; it is very confusing. You should continue
the discussion in the original thread.

Did you try my suggestion? I don't think you should be playing with API
calls unless you are an expert user.
_________________________________________________________________________
 
P

pswanie

nope no expert at all.... so i will skip the API thingie

i tried that but it gave me an error...

this is wat i did

with the workbook open i right click on the green thingie on left top coner
view code
paste


Public fMacro As Boolean

Private Sub Workbook_BeforeClose()
If Not fMacro Then Cancel = True
End Sub

and then in my macro that save and print and quit

change

ActiveWorkbook.Save
Application.Quit

to this
ActiveWorkbook.Save
ThisWorkbook.fMacro = True



this did not work.
 
V

Vasant Nanavati

You still need Application.Quit as the last line.
_________________________________________________________________________
 
V

Vasant Nanavati

Also, my mistake, sorry. Should be:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
_________________________________________________________________________
 
P

pswanie

thats exactly what i needed!!!

thanx...



Vasant Nanavati said:
Also, my mistake, sorry. Should be:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
_________________________________________________________________________
 
V

Vasant Nanavati

Great, glad it worked!
_________________________________________________________________________
 

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

Top