Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

20 Mayıs 2008 Salı

Sheet PopUp [Special Control] Menu



'ThisWorkbook Module

Option Explicit

Private Sub Workbook_Activate()
On Error Resume Next
Application.CommandBars("[PBİD®] WorkSheets Menü").Visible = True
On Error GoTo 0
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
Application.CommandBars("[PBİD®] WorkSheets Menü").Visible = False
On Error GoTo 0
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Call PopUpMenüYap
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
PopUpMenüBoz
End Sub

'Module1

Option Explicit
Dim CB As CommandBar
Dim CBP As CommandBarPopup
Dim CBB As CommandBarButton

Sub PopUpMenüYap()
On Error GoTo Hata:
Call PopUpMenüBoz
Set CB = CommandBars.Add(Name:="[PBİD®] WorkSheets Menü", Position:=MsoBarPosition.msoBarFloating, temporary:=True)
With CB
Set CBP = .Controls.Add(Type:=msoControlPopup)
With CBP
.Caption = "[PBİD®] Popup 1"
.BeginGroup = True
Set CBB = .Controls.Add(Type:=msoControlButton)
With CBB
.Caption = "[PBİD®] Button 1a"
.Style = msoButtonIconAndCaption
.BeginGroup = True
.OnAction = "Macro1a"
.FaceId = 45
End With
Set CBB = .Controls.Add(Type:=msoControlButton)
With CBB
.Caption = "[PBİD®] Button 1b"
.Style = msoButtonIconAndCaption
.BeginGroup = False
.OnAction = "Macro1b"
.FaceId = 46
End With
End With
Set CBP = .Controls.Add(Type:=msoControlPopup)
With CBP
.Caption = "[PBİD®] Popup 2"
.BeginGroup = False
Set CBB = .Controls.Add(Type:=msoControlButton)
With CBB
.Caption = "[PBİD®] Button 2a"
.Style = msoButtonIconAndCaption
.BeginGroup = True
.OnAction = "Macro2a"
.FaceId = 47
End With
Set CBB = .Controls.Add(Type:=msoControlButton)
With CBB
.Caption = "[PBİD®] Button 2b"
.Style = msoButtonIconAndCaption
.BeginGroup = False
.OnAction = "Macro2b"
.FaceId = 48
End With
End With
.Width = 240
.Top = 200
.Left = 200
.Visible = True
.Enabled = True
.Protection = msoBarNoResize
.RowIndex = 1
End With
Exit Sub
Hata:
Call PopUpMenüBoz
End Sub
Sub PopUpMenüBoz()
On Error Resume Next
CommandBars("[PBİD®] WorkSheets Menü").Delete
On Error GoTo 0
End Sub

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul