- ©«¤l
- 61
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 72
- ÂI¦W
- 0
- §@·~¨t²Î
- win 7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-11-4
- ³Ì«áµn¿ý
- 2015-9-16
|
¬Oªº, ¥[±K¦³³]©w.
¦p¦ó¤£ÅýVBEªºÀô¹Ò, ¥i¥H¶i¤J.
google¬d¨ìªº¤èªk, ¸Õ¤£¥X¨Ó.
¦p¤U½Ð°Ñ¦Ò.
'// Run DisableGettingIntoVBE from a Event procedure
'// eg. Workbook_Open or Worksheet_Activate
'// THEN run EnableGettingIntoVBE from the Opp Event procedure
'// eg. Workbook_Close or Worksheet_Deactivate
Sub DisableVBE()
Application.VBE.MainWindow.Visible = False '// Close ALL windows 1st!
CmdControl 1695, False '// Visual basics Editor
CmdControl 186, False '// Macros...
CmdControl 184, False '// Record New Macro...
CmdControl 1561, False '// View Code
CmdControl 1605, False '// Design Mode
Application.OnDoubleClick = "Dummy"
CommandBars("ToolBar List").Enabled = False
Application.OnKey "%{F11}", "Dummy"
End Sub
Sub EnableVBE()
CmdControl 1695, True '// Visual basics Editor
CmdControl 186, True '// Macros...
CmdControl 184, True '// Record New Macro...
CmdControl 1561, True '// View Code
CmdControl 1605, True '// Design Mode
Application.OnDoubleClick = ""
CommandBars("ToolBar List").Enabled = True
Application.OnKey "%{F11}", ""
End Sub
Sub CmdControl(Id As Integer, TF As Boolean)
Dim CBar As CommandBar
Dim C As CommandBarControl
On Error Resume Next
For Each CBar In Application.CommandBars
Set C = CBar.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = TF
Next
End Sub
Sub Dummy()
'// NoGo, leave blank OR Display a message eg.
'MsgBox "Sorry you this command is NOT available", vbCritical
End Sub |
|