View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 134
Default turning off minimize, maximize & close

Thanks again Libby

I located the code as you instructed

Public CloseSwitc
Sub Workbook_Open(
CloseSwitch = Tru
End Su
Sub Workbook_Before_Close(
Select Case CloseSwitc
Case Tru
Cancel = True 'Workbook can't be close
Case Fals
Cancel = False 'Workbook can be close
End Selec

Note Workbook_Before_Close rather than Workbook Before_Close. Do I have it correct

However, the close switch continues to close the workbook

What should I do

Thanks

Kevi
----- Libby wrote: ----

Kevi

under the project explorer double click on workboo
put the Public CloseSwitch under the declaration
set the CloseSwitch to true under the workbook_open even
and the select case in the workbook before_close even

None of it is in a module

being public the CloseSwitch can be changed in other
procedures such as your macr

-----Original Message----
Libby, thanks for the response. However, I can't get

this to work
With the following code in Module1
Public CloseSwitc

Sub Workbook_Open(
CloseSwitch = Tru
End Su
And no other code in the workbook, I am able to close the

workbook
Have I applied the code correctly
Also is the following a complete subroutine? Do I place

it in a module
Sub Workbook Before_Close(

Select Case CloseSwitc
Case Tru
Cancel = True 'Workbook can't be close
Case Fals
Cancel = False 'Workbook can be close
End Selec
Thanks again
Kevi

----- Libby wrote: ----
H
Not sure about the minimise/maximise but you can

disable
the close button by using a CloseSwitch variabl
Public CloseSwitc
Sub Workbook_Open(

CloseSwitch = True 'set the switch to tru
end su
Sub Workbook Before_Close(

Select Case CloseSwitc
Case Tru
Cancel = True 'Workbook can't be close
Case False
Cancel = False 'Workbook can be close
End Selec
Having set the CloseSwitch to True on opening the

workbook, the workbook can't be closed. Set the
CloseSwitch to False in your AutoClose macro and the
workbook will close
-----Original Message----

I want to add a level of security to my file to

force the
file to auto close by macro only. I've added code

to turn
of the menus. Is there code I can include to turn

off the
three icons in the upper left corner; minimize,
restor/maximize & close
Thanks
Kevi