A
Andy Weston
Hi,
I am adding an ActiveX control to an Office toolbar by
adding a control of type msoControlActiveX as in the code
below.
I later assign the class id of my ActiveX control to the
ActiveX control
AXControl.ControlCLSID = "{xxxxxxxx-xxxx-xxxx-xxxx-
xxxxxxxxxxxx}"
My problem is that I cannot control the size of the
commandbar.
When I create the control as follows the commandbar is
resized:
Set m_oBarControl = m_oCmdBar.Controls.Add
(Type:=msoControlActiveX, Temporary:=True)
The commandbar width and height are read only so I do not
appear able to resize it. I can resize it manually. If I
add a standard control type such as a button the command
bar sizes correctly.
Can anyone help with a solution?
I'm actually working in C++ using ATL but here is the
same in VB.
Code snipet:
Set m_oCommandBars = m_oWordApp.CommandBars
Dim strCBarName As String
strCBarName = "Test Toolbar"
Set m_oCmdBar = m_oCommandBars.Add(Name:=strCBarName,
Position:=msoBarTop, MenuBar:=False, Temporary:=True)
m_oCmdBar.Visible = True
Set m_oBarControl = m_oCmdBar.Controls.Add
(Type:=msoControlActiveX, Temporary:=True)
I am adding an ActiveX control to an Office toolbar by
adding a control of type msoControlActiveX as in the code
below.
I later assign the class id of my ActiveX control to the
ActiveX control
AXControl.ControlCLSID = "{xxxxxxxx-xxxx-xxxx-xxxx-
xxxxxxxxxxxx}"
My problem is that I cannot control the size of the
commandbar.
When I create the control as follows the commandbar is
resized:
Set m_oBarControl = m_oCmdBar.Controls.Add
(Type:=msoControlActiveX, Temporary:=True)
The commandbar width and height are read only so I do not
appear able to resize it. I can resize it manually. If I
add a standard control type such as a button the command
bar sizes correctly.
Can anyone help with a solution?
I'm actually working in C++ using ATL but here is the
same in VB.
Code snipet:
Set m_oCommandBars = m_oWordApp.CommandBars
Dim strCBarName As String
strCBarName = "Test Toolbar"
Set m_oCmdBar = m_oCommandBars.Add(Name:=strCBarName,
Position:=msoBarTop, MenuBar:=False, Temporary:=True)
m_oCmdBar.Visible = True
Set m_oBarControl = m_oCmdBar.Controls.Add
(Type:=msoControlActiveX, Temporary:=True)