|OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.|
The CommandBars of the Office library allow you to create your own toolbars and menubars with buttons. The sample also shows how to create a variable so that you can receive an event of that object, in this case a click event of a button.
It's recommended to always create the objects temporarily, so that they are being removed automatically as soon as you close the document or application.
Private WithEvents Button As Office.CommandBarButton Private Sub Application_Startup() Dim oExplorer As Outlook.Explorer Set oExplorer = Application.ActiveExplorer Set Button = CreateCommandBarButton(oExplorer.CommandBars) End Sub Private Sub Button_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) MsgBox "Click: " & Ctrl.Caption End Sub Private Function CreateCommandBarButton(oBars As Office.CommandBars) As Office.CommandBarButton On Error Resume Next Dim oMenu As Office.CommandBar Dim oBtn As Office.CommandBarButton Const BAR_NAME As String = "YourCommandBarName" Const CMD_NAME As String = "YourButtonName" Set oMenu = oBars(BAR_NAME) If oMenu Is Nothing Then Set oMenu = oBars.Add(BAR_NAME, msoBarTop, , True) Set oBtn = oMenu.Controls.Add(msoControlButton, , CMD_NAME, , True) oBtn.Caption = CMD_NAME oBtn.Tag = CMD_NAME Else Set oBtn = oMenu.FindControl(, , CMD_NAME) If oBtn Is Nothing Then Set oBtn = oMenu.Controls.Add(msoControlButton, , CMD_NAME, , True) End If End If oMenu.Visible = True Set CreateCommandBarButton = oBtn End Function
|Access the master category list in the blink of an eye, share your color categories in a network, get a reminder service, and more.|