- ©«¤l
- 56
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 81
- ÂI¦W
- 0
- §@·~¨t²Î
- Window7
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-6-25
- ³Ì«áµn¿ý
- 2016-1-17
|
´¿¦¬¶°¨ìÃþ¦ü¤À¨É¡A¥HVBA ¼g©ó Workbook ¶}±Ò¦Û©w¸q«ö¶s¡A©óÃö³¬Àɮ׮ɧR°£
¦ý¥¼¸Ô²Ó¬ã¨s¨ä¼gªk¡A¥u§ó§ï¦Û¤v±ý©w¸qªº¦a¤è
¥i¶}±Òªþ¥ó¦Û¦æ¬ã¨s§Y¥i¡AY¹ï VBA ¦³°ò¦À³¸Ó¥i»´©öª¾¹D¸Ó§ó§ï¦a¤è
Y·Qª¾¹D¸Ô²Ó¼gªk§t·N¡A»Ý¨ä¥L°ª¤â¨ó§UÄÀºÃ¡A
§Ú¥uª¾¹D¬Y¨Ç°Ï¶ô¡A§Æ±æ¦³À°§U
´ú¸ÕÓ¤Hªí³æ¥¨¶°.rar (8.79 KB)
¤è¦¡
¥DnVBA ¦p¤U
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("´ú¸Õ").Select
On Error Resume Next
Application.CommandBars("MyMenu").Delete
Application.CommandBars("ply").Controls("Ó¤H¾Þ§@ªí³æ").Delete
End Sub
Private Sub Workbook_Open()
Sheets("´ú¸Õ").Select
On Error Resume Next
Application.CommandBars("MyMenu").Delete
Application.CommandBars("ply").Controls("Ó¤H¾Þ§@ªí³æ").Delete
Dim MyMenuBar As CommandBar
Dim MyButton As CommandBarButton
Set MyMenuBar = Application.CommandBars.Add
With MyMenuBar
.Visible = True
.Name = "MyMenu"
.Position = msoBarTop
Set MyButton = .Controls.Add
With MyButton
.Visible = True
.Caption = "Ó¤H¾Þ§@ªí³æ(&P)"
.Style = msoButtonIconAndCaption
.FaceId = 988
.OnAction = "´ú¸ÕÓ¤Hªí³æ¥¨¶°"
End With
End With
Set MyButton = Application.CommandBars("ply").Controls.Add(msoControlButton, , , 1)
With MyButton
.Caption = "Ó¤H¾Þ§@ªí³æ"
.Visible = True
.FaceId = 456
.OnAction = "´ú¸ÕÓ¤Hªí³æ¥¨¶°"
End With
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
On Error Resume Next
If Workbooks.Count = 1 Then
Application.CommandBars("MyMenu").Controls("Ó¤H¾Þ§@ªí³æ(&P)").Enabled = False
End If
End Sub |
|