CommandBarButton and Office 97

F

Ferran Bonàs

I'm trying to develop a new toolbar for Office 97 with
VC++.

I'm able to add this new toolbar with two new buttons but
I can't get the on click event. Examining msword8.olb and
mso97.dll I've seen that is not possible.

Another solution is to use de SetOnAction method, but the
parameter must be a macro and I don't want that. I want to
call a method from my MFC Application in C++.

Any solutions?

Thanks in advance and excuse for my english.
 
L

losmac

Code below is an example of creating commandbarbutton in VB

Sub AddCmd()
Dim cb As CommandBar
Dim ctr As CommandBarButton

'msoBarLeft, msoBarTop, msoBarRight, msoBarBottom
Indicate the left, top, right, and bottom coordinates of
the new command bar
'msoBarFloating Indicates that the new command bar won't
be docked
'msoBarPopup Indicates that the new command bar will be a
shortcut menu
On Error Resume Next
'first delete
CommandBars("QWE").Delete

Set cb = CommandBars.Add("QWE", msoBarFloating)
cb.Visible = True
'MsoControlType constants: msoControlButton,
msoControlEdit, msoControlDropdown, msoControlComboBox, or
msoControlPopup.
Set ctr = cb.Controls.Add(msoControlButton)
With ctr
.Caption = "AAA"
'.BeginGroup = True if You want separator
.TooltipText = .Caption
.OnAction = "Your function/procedure name" 'this
function will be execute OnClick event
End With

Set ctr = Nothing
Set cb = Nothing

End Sub
 

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