Disable Shift Bypass Key from Excel? 
Author Message
 Disable Shift Bypass Key from Excel?

Goodmorning,

I have a couple of Excel workbooks that format their Windows a certain way
(disable some submenus, bring up custom command bars, use full screen, etc)
from their Open event (and then, of course, everything is restored to normal in
the BeforeClose Event).  But it turns out that a user can bypass this by
pressing the Shift Key when opening the respective workbooks.  I know that in
Access you can disable the Shift Bypass key as follows:

Sub DisableShiftKey()
   Dim i As Integer
   ChangeProperty "AllowBypassKey", i
End Sub

------this is the call - and here is the function ChangeProperty:

Function ChangeProperty(strPropName As String, varPropValue As Variant) As
Integer
   Dim dbs As Database
   Set dbs = CurrentDb
   dbs.Properties(strPropName) = varPropValue
   ChangeProperty = True
End Function

-----Can this be done in Excel?  I tried using Application in place of dbs, but
it did not bring up a Properties option.   Any suggestions would be greatly
appreciated.

Regards,
Rich



Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?
You cannot disable the shift bypass key in Excel
Wouldn't virus writers like it if you could?

What you can do is hide all interesting sheets, protect the workbook
structure and the VBProject if using 97/2000 (you didn't say which
version; it always helps), so that if the user opens the workbook with
its macros disabled they won't be able to do much with it.

Bill Manville
MVP - Microsoft Excel, Oxford, England



Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?
Here is what I have going.  On this one workstation (mysteriously) a bunch of
custom buttons on a custom command bar get rearranged.  Well, in this one excel
addin - which opens with every workbook - I have the all the buttons listed in
an array and certain buttons become visible or invisible for respective
workbooks.  As long as a user has access to the custom dialog box (from the
tool list) they can either rearrange the order of the buttons (by dragging
them) or change the names of the buttons.  Then the buttons don't appear with
the correct workbooks - or appear at all.  I can disable the toolbar list and
lock all the toolbars - but if the user presses the shift key - THAT bypasses
all the securing I have done.  
Would you know if there is a way to detect if the Shift key is being pressed?


Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?

Quote:

> I can disable the toolbar list and
> lock all the toolbars - but if the user presses the shift key - THAT bypasses
> all the securing I have done.  

So maybe you need to do more securing.  If you do as I suggested and password
protect and hide the dialog sheet and password protect the workbook structure
you should prevent tampering.

Quote:
> Would you know if there is a way to detect if the Shift key is being pressed?

What would you expect to detect it?  Clearly your Auto_Open / Workbook_Open
cannot detect it if it is not being run.  Your code can test later whether the
startup did run (e.g. get Workbook_Open to set a public variable to True and
test it in other procedures that might be run later).  But I think this is
taking you the wrong way.  In Excel 97/2000 it is not just a shift key question
- the virus dialog gives people a button to press to inhibit your macros.  In
any version of Excel your workbook can be opened by program without the _Open
macros running.  You really have to protect the workbook so that people
bypassing the macros cannot cause damage without cracking passwords.

Bill Manville
MVP - Microsoft Excel, Oxford, England



Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?
Create you commandbar with code and remove it when the application completes
(remove it when it starts as well so you are always working with a new
version).  Then if the workbook is opened without enabling macros, there is
no commandbar to play with.

Regards,
Tom Ogilvy
MVP Excel

Quote:

>Here is what I have going.  On this one workstation (mysteriously) a bunch
of
>custom buttons on a custom command bar get rearranged.  Well, in this one
excel
>addin - which opens with every workbook - I have the all the buttons listed
in
>an array and certain buttons become visible or invisible for respective
>workbooks.  As long as a user has access to the custom dialog box (from the
>tool list) they can either rearrange the order of the buttons (by dragging
>them) or change the names of the buttons.  Then the buttons don't appear
with
>the correct workbooks - or appear at all.  I can disable the toolbar list
and
>lock all the toolbars - but if the user presses the shift key - THAT
bypasses
>all the securing I have done.
>Would you know if there is a way to detect if the Shift key is being

pressed?


Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?
You can disable the shift key if you use a vb app to start excel and the
SetKeyboardState api...


Quote:
> You cannot disable the shift bypass key in Excel
> Wouldn't virus writers like it if you could?

> What you can do is hide all interesting sheets, protect the workbook
> structure and the VBProject if using 97/2000 (you didn't say which
> version; it always helps), so that if the user opens the workbook with
> its macros disabled they won't be able to do much with it.

> Bill Manville
> MVP - Microsoft Excel, Oxford, England



Wed, 18 Jun 1902 08:00:00 GMT  
 Disable Shift Bypass Key from Excel?


Quote:
> You can disable the shift key if you use a vb app to start excel and the
> SetKeyboardState api...

No doubt, and it's good to know that, but I don't think it addresses the
originator's problem which was how to stop users from disabling his macros
by using the shift key when opening his workbook in Excel.

Bill Manville
MVP - Microsoft Excel, Oxford, England



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. URGENT, pls: Disabling shift key bypass

2. Disabling shift key bypass through code

3. Access 97 Disabling Shift Key bypass function

4. URGENT, pls: Disabling shift key bypass

5. Shift bypass key disabling question.

6. How do I disabling the Shift bypass key?

7. Disable the Shift Bypass key on Startup

8. Disabling shift key bypass for autoexec macro

9. Disabling Shift Key Bypass

10. Disabling the shift key so that the startup cannot be bypassed


 
Powered by phpBB® Forum Software © phpBB Group