need help!

T

Tobias Bergmann

I created a com add in now I have a problem :

How can I exactly define what commandBarButtons do??
How can I use them??
 
B

Bernd

Tobias said:
I created a com add in now I have a problem :

How can I exactly define what commandBarButtons do??
How can I use them??
Hi Tobias,

in order to react to clicks on a commandbar button you have to declare
a variable which will points to that button:

[private|public] WithEvents btCreateDocument As CommandBarButton

In addition, you must define an event handler:
Private Sub btCreateDocument_Click(ByVal Ctrl As CommandBarButton, _
ByRef CancelDefault As Boolean) _
Handles btCreateDocument.Click

' Insert her the code to be executed when the user has
' clicked on the button

End Sub


Don't forget to assign your button variable a value after
you have added your button to a commandbar.

btCreateDocument = ActiveCommandbar.Controls.Add....

Kind regards
Bernd
 
T

Tobias Bergmann

I tried it theat way, but it only works for VBA not for VB6. I cannot assign
an event to a CommandBarButton like that.

It only says that no automation processes are made by this object.

Bernd said:
Tobias said:
I created a com add in now I have a problem :

How can I exactly define what commandBarButtons do??
How can I use them??
Hi Tobias,

in order to react to clicks on a commandbar button you have to declare
a variable which will points to that button:

[private|public] WithEvents btCreateDocument As CommandBarButton

In addition, you must define an event handler:
Private Sub btCreateDocument_Click(ByVal Ctrl As CommandBarButton, _
ByRef CancelDefault As Boolean) _
Handles btCreateDocument.Click

' Insert her the code to be executed when the user has
' clicked on the button

End Sub


Don't forget to assign your button variable a value after
you have added your button to a commandbar.

btCreateDocument = ActiveCommandbar.Controls.Add....

Kind regards
Bernd
 

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