Program "Click on Ribbon Button" Using VBA

Status
Not open for further replies.
H

hlock

I don't know if anyone can help me, but I thought I would ask. In Outlook

2007, we have a 3rd party add-in that imports an email to a document

repository. The "Save to Vignette IDM" button resides on the command bar in

explorer and in the Add-Ins menu on the ribbon. Thanks to Sue Moshier, we

are able to "click" on the button on the command bar in explorer. However,

the code only runs for the highlighted email in explorer. The problem is

when we have multiple emails up and want to import an open email that is not

selected in explorer. The code runs, but it imports the selected email in

explorer, not the active email.

I need to be able to "click" on the button on the ribbon using vba

(basically execute the event with vba) and execute the command for the open

email (inspector). I don't want to modify the code. Unfortunately, I do not

have access to the source. Any ideas?

Sub RunIt()

Dim cb As Office.CommandBar

Dim cbb As Office.CommandBarButton

Dim ctrl As Office.CommandBarControl

Dim exp As Outlook.Explorer

Set exp = Application.ActiveExplorer

Set cb = exp.CommandBars("Standard")

For Each ctrl In cb.Controls

If ctrl.Caption = "Save to Vignette IDM" Then

Set cbb = ctrl

cbb.Execute

Exit For

End If

Next

Set cb = Nothing

Set cbb = Nothing

Set ctrl = Nothing

Set exp = Nothing

End Sub

Thanks.
 
K

Ken Slovak - [MVP - Outlook]

If the code only works on a selected item in an Explorer then that won't

help you at all for an Inspector. The button code would need to work on

ActiveInspector, not on Selection(1).

I don't see any way of doing what you want unless you write your own code to

mirror the functions of the button, or you get the addin author to change

things for you.

"hlock" <hlock> wrote in message

news:1FF17730-FD07-44C5-9C39-907A207E9544@microsoft.com...
> I don't know if anyone can help me, but I thought I would ask. In Outlook
> 2007, we have a 3rd party add-in that imports an email to a document
> repository. The "Save to Vignette IDM" button resides on the command bar
> in
> explorer and in the Add-Ins menu on the ribbon. Thanks to Sue Moshier, we
> are able to "click" on the button on the command bar in explorer.
> However,
> the code only runs for the highlighted email in explorer. The problem is
> when we have multiple emails up and want to import an open email that is
> not
> selected in explorer. The code runs, but it imports the selected email in
> explorer, not the active email.

> I need to be able to "click" on the button on the ribbon using vba
> (basically execute the event with vba) and execute the command for the
> open
> email (inspector). I don't want to modify the code. Unfortunately, I do
> not
> have access to the source. Any ideas?

> Sub RunIt()
> Dim cb As Office.CommandBar
> Dim cbb As Office.CommandBarButton
> Dim ctrl As Office.CommandBarControl
> Dim exp As Outlook.Explorer

> Set exp = Application.ActiveExplorer
> Set cb = exp.CommandBars("Standard")
> For Each ctrl In cb.Controls
> If ctrl.Caption = "Save to Vignette IDM" Then
> Set cbb = ctrl
> cbb.Execute
> Exit For
> End If
> Next

> Set cb = Nothing
> Set cbb = Nothing
> Set ctrl = Nothing
> Set exp = Nothing
> End Sub
> Thanks.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Email Generated from another program and then edited sends original email. Using Outlook 2
J Program Checkbox that will activate a text box in a Outlook fallible form. Outlook VBA and Custom Forms 1
T Outlook "A program is trying to access Outlook" Using Outlook 3
Andrew Quirl Open attachment, manipulate without add-on program? Outlook VBA and Custom Forms 5
R SearchPublicFolders program Outlook VBA and Custom Forms 1
Diane Poremsky To Change the Default E-mail Program in Windows Using Outlook 0
I There is no email program associated to perform requested action Using Outlook 0
Diane Poremsky Trial/Beta program for BCM replacement BCM (Business Contact Manager) 8
J it goes like outlook has stopped working, a problem caused the program to stop working correctly, wi Using Outlook 2
J My Outlook program has stopped receiving. I can still send Using Outlook 1
C New version of MFCMAPI program Using Outlook 0
K A program is trying to send an e-mail message on your behalf... Using Outlook 1
A outlook 2007 - there is no email program associated ... Using Outlook 3
F Default Program for Opening .pst Files ? Using Outlook 6
A Outlook-Program Not Closing Properly Using Outlook 10
B How to remove an old program from the Tools dropdown? Using Outlook 7
D How to set permissions to allow external program to send an email? Using Outlook 0
T getting an error This file does not have a program associated with it for performing this action. C Using Outlook 7
N The add-in "C:\program files\google\google desktop search\googledesktopO..." could not be installed Using Outlook 32
R Access Program Only Looping Part Way Through Outlook Inbox Outlook VBA and Custom Forms 2
M Allow or Deny when a Program tries to send an email Outlook VBA and Custom Forms 1
R how to (re)set the default data file for Outlook in a VB program Outlook VBA and Custom Forms 2
J Program won't end in Win7 Outlook VBA and Custom Forms 1
D Outlook 2003 - A program is trying to access e-mail addresses Outlook VBA and Custom Forms 5
D Running a Program from Custom Action Rule Outlook VBA and Custom Forms 1
S Email Organizer Program Outlook VBA and Custom Forms 2
G GAL program acces in outlook 2007 Outlook VBA and Custom Forms 2
H Program email save as text file Outlook VBA and Custom Forms 5
M Run external program from Outlook VBA macro Outlook VBA and Custom Forms 5
N How to attach a file with MS Outlook, from a program? Outlook VBA and Custom Forms 3
Q why this program doesn't work if Outlook is not manually launched? Outlook VBA and Custom Forms 4
V how to switchoff program access message in outlook 2003 Outlook VBA and Custom Forms 1
V "A program has attachment filename open" Message returns Outlook VBA and Custom Forms 4
J Program Compatibility Issue - Outlook 2003 BCM BCM (Business Contact Manager) 4
F Jump to Inbox folder when click on Favorite Using Outlook 8
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
P Unread Until Click Another Message? Using Outlook 2
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
Diane Poremsky Using Scanpst in Outlook Click to Run Using Outlook 0
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
B Open a folder / subfolder of a PST in single click Outlook VBA and Custom Forms 4
C Reminder for single-click appointment Using Outlook 2
Diane Poremsky Contacts are missing when you click the To button Using Outlook 0
M Office 365 Click to run BCM (Business Contact Manager) 0
williamlambton Reinstate "Open" button on mail item right-click context menu. Outlook Wishlist 2
B Auto name checking upon Tab or Click off To field(s) Using Outlook 19
F Jump to Inbox folder when click on Favorite Using Outlook 0
D Must now "View on Facebook" for Mentions/Comments-Outlook 2013 click-to-run Using Outlook 2
I BCM Opportunity: click on "new op" opens a "new tasks" BCM (Business Contact Manager) 0

Similar threads

Top