Pressing a button in outlook 2007 toolbar (commandbar)

D

dushkin

Hi All,

I wish to press a button in an Office 2007 commandbar.
I use vb script.

This is what I wrote this far:

----------------------------------------------------------------------------------
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Set myOlExp = objOutlook.ActiveExplorer
Set myCmdBars = myOlExp.CommandBars
Set standardBar = myCmdBars.Item("Standard") ' Standard is the name of
the CommandBar

For Each ctl In standardBar.Controls

If ctl.Caption = "My Button" Then
' I want to press this toolbar button here!
End If
Next

Wscript.Echo "done"
 
D

dushkin

I don't know if you are going to be able to press a button, but you can use
SendKeys to send the key strokes to go through the menus to get to the menu
items.

Also, for a variety of menuitems there are ways to call them from
automation.  Perhaps you can say what button you are trying to push.

Thank You Jordan,

The button I am trying to push is an Add-in button that my company
developed and added to Outlook.
But let us stick to the generic problem: How can I operate on this
button?
I read about CommandBarButton (http://msdn.microsoft.com/en-us/library/
aa190794%28v=office.10%29.aspx) which I hoped it would be helpful for
me, but I couldn't find how?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top