![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Having read some of the postings on this website, I have managed to define my
own custom button 'HSE Monitors' on the 'Main Menu' commandbar. However, I have not been able set-up the command button to execute the required macro. The required macro being 'SaveAttachment' in the 'ThisOutlookSession' module. Can anyone help. I have listed the code I have tried so far. I am using Excel 2000. Private Sub Application_Startup() Dim objOL As Outlook.Application Dim colCB As Office.CommandBars Dim objCB As Office.CommandBar Dim objCBMenu As Office.CommandBarPopup Dim objCBMenuCB As Office.CommandBar Dim objCBB As Office.CommandBarButton Set objOL = CreateObject("Outlook.Application") Set colCB = objOL.ActiveExplorer.CommandBars Set objCB = colCB.Item("Menu Bar") For Each Control In objCB.Controls If Control.Caption = "HSE Monitors" Then GoTo ByPass Next Control Set objCBMenu = objCB.Controls.Add(Type:=msoControlPopup, Temporary:=True) With objCBMenu .Caption = "HSE Monitors" Set objCBMenuCB = .CommandBar Set objCBB = objCBMenuCB.Controls.Add(Type:=msoControlButton, Temporary:=True) objCBB.Caption = "Check Monitor Emails" objCBB.OnAction = "ThisOutlookSession.SaveAttachment" End With ByPass: Set objButton = Nothing Set objBar = Nothing Set objOL = Nothing Set colCB = Nothing Set objCB = Nothing Set objCBMenu = Nothing Set objCBMenuCB = Nothing Set objCBB = Nothing End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200609/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Binding a Control to an ADODC Control, Is it possible | Andrew Sampels | Outlook - Using Forms | 1 | August 8th 06 10:02 PM |
How can I run a macro from a custom button control | AA | Outlook - Using Forms | 1 | June 20th 06 10:35 PM |
Execute rules with a macro | Gerd Neumann | Outlook and VBA | 1 | May 11th 06 09:50 PM |
Command Failed to Execute | JAYDEEP DESAI | Outlook Express | 1 | April 6th 06 01:23 PM |
Outlook 2002 Execute Files | Sylvia | Outlook - General Queries | 2 | April 6th 06 04:02 AM |