PC Review


Reply
Thread Tools Rate Thread

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

 
 
Sqt Waddle
Guest
Posts: n/a
 
      7th Mar 2010
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,
 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      8th Mar 2010


Don't use OnAction but a variable declared withEvents and set to the
CommandBarButton object. See this example:
http://www.vboffice.net/sample.html?...6&cmd=showitem

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?lang=en>


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,

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid procedure call or argument Per Moeller-Olsen Microsoft Excel Programming 4 27th Apr 2009 10:38 PM
how to call Oracle Stored Procedure from MS ACCESS 2007 VB csidb Microsoft Access VBA Modules 5 11th Oct 2008 12:44 AM
Command button Event procedure in Access 2007 =?Utf-8?B?Sko=?= Microsoft Access VBA Modules 2 17th Nov 2006 01:03 PM
Command button Event procedure in Access 2007 =?Utf-8?B?Sko=?= Microsoft Access Form Coding 0 16th Nov 2006 03:17 PM
How to enable Remote Procedure Call by command line? Weiping Chen Microsoft Windows 2000 Setup 2 24th Apr 2004 09:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:07 PM.