How to call a procedure from a custom command bar in Outlook 2007

Status
Not open for further replies.
S

Sqt Waddle

Hello and TIA for your assistance,

I am trying to convert VBA code in OL07 to an Add-in in VB6.

The Add-in creates a custom command bar with three buttons and fires code

when a new inspector is created.

When I load the add-in the command bar appears, the new inspector code fires

and the add-in disconnects on exit.

However, I cannot get the onaction event for the command bar buttons to fire.

The code that creates the button is:

Set custBar = Application.ActiveExplorer.CommandBars.Add(Name:="Show",

Position:=msoBarTop, Temporary:=True)

custBar.Visible = True

Set Cusbutton = custBar.Controls.Add(Type:=msoControlButton)

With Application.ActiveExplorer.CommandBars("Show").Controls(1)

> Style = msoButtonCaption

> Caption = "My Stuff"

> OnAction = "RunMyStuff"

> ToolTipText = "My Stuff"

> BeginGroup = True

> Tag = "Test Tag"

End With

Where should I place Sun RunMyStuff so that it will fire when the button is

clicked?

Thanks,
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Don't use OnAction but a variable declared withEvents and set to the

CommandBarButton object. See this example:

http://www.vboffice.net/en/developers/create-new-commandbar-with-one-button

Best regards

Michael Bauer

Am Sat, 6 Mar 2010 23:42:01 -0800 schrieb Sqt Waddle:


> Hello and TIA for your assistance,

> I am trying to convert VBA code in OL07 to an Add-in in VB6.

> The Add-in creates a custom command bar with three buttons and fires code
> when a new inspector is created.

> When I load the add-in the command bar appears, the new inspector code


fires
> and the add-in disconnects on exit.

> However, I cannot get the onaction event for the command bar buttons to


fire.

> The code that creates the button is:
> Set custBar = Application.ActiveExplorer.CommandBars.Add(Name:="Show",
> Position:=msoBarTop, Temporary:=True)
> custBar.Visible = True

> Set Cusbutton = custBar.Controls.Add(Type:=msoControlButton)
> With Application.ActiveExplorer.CommandBars("Show").Controls(1)
> .Style = msoButtonCaption
> .Caption = "My Stuff"
> .OnAction = "RunMyStuff"
> .ToolTipText = "My Stuff"
> .BeginGroup = True
> .Tag = "Test Tag"
> End With

> Where should I place Sun RunMyStuff so that it will fire when the button


is
> clicked?

> Thanks,
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Comcast IMAP broken but their second level support said to call "the Outlook company" Using Outlook 4
R Call a Public Sub when a Flag is clicked on in the Message Preview pane Outlook VBA and Custom Forms 1
CWM030 Call me old if you want. OL 2016 font size out of the box. Using Outlook 3
F Outlook 2016 call to Stop Timer Event Outlook VBA and Custom Forms 4
C Unchecking "Send immediately when connected" does not work on apps that call Outlook Using Outlook 1
M How to call custom email form when sender = x Using Outlook 3
D Create additional custom flag descriptions (other than Send E-Mail, Call etc.) Using Outlook 1
K call a help file when click on a button xml ribbon Outlook VBA and Custom Forms 1
C OL Sub through or by Excel Macro Call Outlook VBA and Custom Forms 1
R Phone Call Start Date - Phone Log BCM (Business Contact Manager) 1
B Good Call Log Concept? Outlook VBA and Custom Forms 5
J Outlook custom form - VBS call VBA macro Outlook VBA and Custom Forms 3
T exception when I call ActiveDocument.Range(0,0).Editors.Add(-1) Outlook VBA and Custom Forms 2
D Call add-in method from macro? Outlook VBA and Custom Forms 1
M Phone Log Reminder to call back BCM (Business Contact Manager) 1
R Help, Outlook2003 won't quit after call OnDisconnection? Outlook VBA and Custom Forms 3
S Custom VBA forms in Outlook--how to call w/macro? Outlook VBA and Custom Forms 1
C How do you call a exe and interact with the output interactively Outlook VBA and Custom Forms 2
N VBA Procedure (or Macro) to Stop Outlook from Closing? Outlook VBA and Custom Forms 2
L Can't find procedure or module to run Outlook VBA and Custom Forms 4
S Custom Contact card - need help creating one Outlook VBA and Custom Forms 1
S Outlook 2019 Custom outlook Add-in using Visual Studio Outlook VBA and Custom Forms 0
S Adding Custom Forms Outlook VBA and Custom Forms 4
Witzker How to get the button Karte ( map) in custom contact form Outlook VBA and Custom Forms 2
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
D Outlook 365 Custom forms field limit? Outlook VBA and Custom Forms 4
J PSA: How to create custom keyboard shortcut for "Paste Unformatted Text" in Outlook on Windows Outlook VBA and Custom Forms 1
M copy field value to custom field Outlook VBA and Custom Forms 0
J Does the .fdm contain my custom form? How to make ol use it? - ol2007 Outlook VBA and Custom Forms 4
J ol2021 custom form not displaying pics Outlook VBA and Custom Forms 37
N "Perform a Custom Action" Outlook VBA and Custom Forms 0
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
C Create Meeting With Custom Form Outlook VBA and Custom Forms 2
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
J custom form not displaying pictures Outlook VBA and Custom Forms 7
I Button PDF in Outlook Contact custom form Outlook VBA and Custom Forms 1
K Font Sizing in Custom Form Regions for Contacts Outlook VBA and Custom Forms 1
V Update new custom field Outlook VBA and Custom Forms 5
D Anyone tell me where custom view settings are stored? Outlook VBA and Custom Forms 9
S Outlook 2016 Arrange tasks by date, additional custom sorting, but still use friendly terms like Today, Tomorrow, This week? Using Outlook 1
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
H Custom Outlook Contact Form VBA Outlook VBA and Custom Forms 1
S Custom Field Cannot Be Displayed In Views Outlook VBA and Custom Forms 2
D Custom Search Folders not refreshing/updating automatically Using Outlook 0
F Validation on custom task form after task acceptance Outlook VBA and Custom Forms 1
K UDF with formula not showing on Calendar custom view. Outlook VBA and Custom Forms 0
S Create a clickable custom column field Outlook VBA and Custom Forms 0
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
G Other users can't see P.2 with custom fields in Form Outlook VBA and Custom Forms 0

Similar threads

Top