Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   VBA snippet that presses a toolbar button? (http://www.outlookbanter.com/outlook-vba/77208-vba-snippet-presses-toolbar-button.html)

Michael Moser August 19th 08 04:25 PM

VBA snippet that presses a toolbar button?
 
VanguardLH wrote:
Michael Moser wrote:

Outlooks Rules Wizard among other actions also offer an option
"perform a custom action".
If one selects that, however, one gets a selection box (apparently
supposed to be a list of selectable actions, which - however - is
empty, i.e. not a single action to choose from).

Where/how can one define such custom actions? I would like to press a
specific button (or the equivalent of the command behind that
button) on those emails.

Michael


You will have to define those custom actions. Learn VBA. Visit
http://www.outlookcode.com to get some examples.


Since I am not a VBA expert: Would someone by chance be willing to share
a code snippet that allows to programmatically presses a specific
Toolbar button (or call the corresponding action)?

Michael


Michael Bauer [MVP - Outlook] August 19th 08 07:24 PM

VBA snippet that presses a toolbar button?
 


Michael, in general it works this way:

Dim Bnt as Office.CommandbarButton
Dim Bars as Office.Commandbars
Dim BtnID&

' ref to the folder toolbars
Set Bars=Application.ActiveExplorer.Commandbars

' find a specific button by its ID
' example, ID for the Reply button
BtnID = 354
Set Bnt=Bars.FindControl(,BtnID)
Btn.Execute

If you don't know the ID of the button you're looking for, you may use
OutlookSpy from www.dimastr.com for finding it out.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Tue, 19 Aug 2008 17:25:20 +0200 schrieb Michael Moser:

VanguardLH wrote:
Michael Moser wrote:

Outlooks Rules Wizard among other actions also offer an option
"perform a custom action".
If one selects that, however, one gets a selection box (apparently
supposed to be a list of selectable actions, which - however - is
empty, i.e. not a single action to choose from).

Where/how can one define such custom actions? I would like to press a
specific button (or the equivalent of the command behind that
button) on those emails.

Michael


You will have to define those custom actions. Learn VBA. Visit
http://www.outlookcode.com to get some examples.


Since I am not a VBA expert: Would someone by chance be willing to share
a code snippet that allows to programmatically presses a specific
Toolbar button (or call the corresponding action)?

Michael



All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com