- ©«¤l
- 586
- ¥DÃD
- 123
- ºëµØ
- 0
- ¿n¤À
- 763
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-16
- ³Ì«áµn¿ý
- 2017-3-14
|
¥»©«³Ì«á¥Ñ freeffly ©ó 2012-2-22 17:07 ½s¿è
Option Explicit
Private WithEvents GB_CbE As CommandBarEvents
Private WithEvents Big5_CbE As CommandBarEvents
¡@
________________________________________
Private Sub Workbook_Open()
CreateVBEMenu
End Sub
¡@
________________________________________
Private Sub Workbook_AddinInstall()
Dim AI As AddIn, hWnd As Long
On Error Resume Next
hWnd = Application.VBE.MainWindow.hWnd
If Err.Number = 1004 Then
MsgBox "±zªº¦w¥þ©Ê³]©w¤£¤¹³\±z°õ¦æ¦¹µ{§Ç." _
& vbCrLf & vbCrLf & "½Ð§ó§ï¦w¥þ©Ê³]©w«á«·s°õ¦æ:" _
& vbCrLf & vbCrLf & " 1. ÂI¿ï ¤u¨ã - ¥¨¶° - ¦w¥þ©Ê." _
& vbCrLf & " 2. ÂI¿ï '«H¥ô¦s¨ú Visual Basic ±M®×"
On Error Resume Next
For Each AI In Application.AddIns
If AI.Name = ThisWorkbook.Name Then
AI.Installed = False
ThisWorkbook.Close False
End If
Next AI
End If
End Sub
¡@
________________________________________
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.VBE.CommandBars("cmd_TCSC").Delete
Application.VBE.CommandBars(2).Left = 0
End Sub
¡@
________________________________________
Sub CreateVBEMenu()
Dim vcbr As CommandBar, vctl As CommandBarControl
'¦pªG cmd_TCSC¦s¦bªº¸Ü,§R°£¥¦
On Error Resume Next
Application.VBE.CommandBars("cmd_TCSC").Delete
Set vcbr = Application.VBE.CommandBars.Add(Name:="cmd_TCSC", _
Position:=msoBarTop, temporary:=True)
'·s¼WButton
vcbr.Visible = True
vcbr.RowIndex = Application.VBE.CommandBars(2).RowIndex
Set vctl = vcbr.Controls.Add(Type:=msoControlButton)
With vctl
ThisWorkbook.Sheets("icon").Shapes("TCSC").Copy
.PasteFace
.Style = msoButtonIcon
.TooltipText = "ÁcÂà²"
Set GB_CbE = Application.VBE.Events.CommandBarEvents(.Control)
End With
Set vctl = vcbr.Controls.Add(Type:=msoControlButton)
With vctl
ThisWorkbook.Sheets("icon").Shapes("SCTC").Copy
.PasteFace
.Style = msoButtonIcon
.TooltipText = "²ÂàÁc"
Set Big5_CbE = Application.VBE.Events.CommandBarEvents(.Control)
End With
End Sub
¡@
________________________________________
Private Sub GB_CbE_Click(ByVal CommandBarControl As Object, _
handled As Boolean, CancelDefault As Boolean)
Call BIG5_GB
End Sub
¡@
________________________________________
Private Sub Big5_CbE_Click(ByVal CommandBarControl As Object, _
handled As Boolean, CancelDefault As Boolean)
Call GB_BIG5
End Sub
³oÓ¬O¦b¬YÓºô¯¸¤W¬Ý¨ìªº
¥i¥H¥Î¨ÓÂഫ²Å骺VBAÅܦ¨ÁcÅé
§Úª½±µ¶K¨ìµ{¦¡½X¤¤
¥i¬O·|¥X²{°ÝÃD
¦³¤Hª¾¹D«ç»ò¨Ï¥Î³oÓ¶Ü?
¸ê®Æ¨Ó·½ºô§}
http://chijanzen.net/wp/?p=358 |
|