Custom Toolbar Button

B

Bob Howard

Is it possible to fire an event when the user clicks a custom toolbar
button?

Bob
 
M

Marshall Barton

Bob said:
Is it possible to fire an event when the user clicks a custom toolbar
button?


Tool (and menu) bar items have their own interal click event
that calls the function you specify in your custom command
bar item's OnAction property.

The built-in command bar items call their own internal
procedure. You can change the OnAction property of the
built-in buttons, but it would be a bad thing because it
would change the items behavior across your entire
applcation (and maybe even all of Office). Instead create a
new command bar item and use your own code to do what you
want as well as what the real item does.
 
A

Albert D. Kallal

I am not sure what you mean by "fire an event"


You can certainly have a custom button call VBA code (that normally how I
use custom menu items).

That code can most certainly "call" some event code you have in a form.


So, if you wanted to call the after update event of a particular control,
say "company" name after update event, the you could simply put a pubic
function in your form call


Public Function MyCoAfterCall

Call CompanyName_AfterUpdate

end if


and, then for the custom menu/tool bar on-action, you go


=MyCoAfterCall()
 

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

Similar Threads


Top