J
JB
Hi Folks,
I'm using the code below to create toolbars based on toolbar settings in
another template (for my own reasons) which are stored in an ini file.
Everything works great (toolbars are created with all the appropriate
details) except they do not execute my required styles. The buttons
which have macros assigned to them work fine but the buttons I used for
style shortcuts do not. I assumed that the name of the style assigned
to a macro being the same as a style would be enough but it seems I'm a
muppet.
Any pointers??
Cheers
J
CustomizationContext = ActiveDocument
i = 0
For x = 0 To UBound(strMainCBInfo()) - 1
Set oCMdBar = CommandBars.Add(Name:=strMainCBInfo(i, 2),
Position:=msoBarFloating, Temporary:=False)
j = 1
With oCMdBar
.Height = strMainCBInfo(i, 0)
.Left = strMainCBInfo(i, 1)
.Name = strMainCBInfo(i, 2)
.NameLocal = strMainCBInfo(i, 3)
.Position = strMainCBInfo(i, 4)
.RowIndex = strMainCBInfo(i, 5)
End With
y = 1
For j = 0 To UBound(strControlInfo()) - 1
If strControlInfo(j, 1, i) <> "" Then
With oCMdBar
.Controls.Add Type:=msoControlButton
With .Controls.Item(y)
.BeginGroup = strControlInfo(j, 0, i)
.Caption = strControlInfo(j, 1, i)
.DescriptionText = strControlInfo(j, 2, i)
.Enabled = True
.FaceId = strControlInfo(j, 3, i)
.Height = strControlInfo(j, 4, i)
'.ID = strControlInfo(j, 5, i)
.OnAction = strControlInfo(j, 6, i)
.Parameter = strControlInfo(j, 7, i)
.Priority = strControlInfo(j, 8, i)
.ShortcutText = strControlInfo(j, 9, i)
.State = strControlInfo(j, 10, i)
.Style = strControlInfo(j, 11, i)
.Tag = strControlInfo(j, 12, i)
.TooltipText = strControlInfo(j, 13, i)
.Width = strControlInfo(j, 14, i)
End With
.Visible = True
End With
End If
y = y + 1
Next j
i = i + 1
Next x
I'm using the code below to create toolbars based on toolbar settings in
another template (for my own reasons) which are stored in an ini file.
Everything works great (toolbars are created with all the appropriate
details) except they do not execute my required styles. The buttons
which have macros assigned to them work fine but the buttons I used for
style shortcuts do not. I assumed that the name of the style assigned
to a macro being the same as a style would be enough but it seems I'm a
muppet.
Any pointers??
Cheers
J
CustomizationContext = ActiveDocument
i = 0
For x = 0 To UBound(strMainCBInfo()) - 1
Set oCMdBar = CommandBars.Add(Name:=strMainCBInfo(i, 2),
Position:=msoBarFloating, Temporary:=False)
j = 1
With oCMdBar
.Height = strMainCBInfo(i, 0)
.Left = strMainCBInfo(i, 1)
.Name = strMainCBInfo(i, 2)
.NameLocal = strMainCBInfo(i, 3)
.Position = strMainCBInfo(i, 4)
.RowIndex = strMainCBInfo(i, 5)
End With
y = 1
For j = 0 To UBound(strControlInfo()) - 1
If strControlInfo(j, 1, i) <> "" Then
With oCMdBar
.Controls.Add Type:=msoControlButton
With .Controls.Item(y)
.BeginGroup = strControlInfo(j, 0, i)
.Caption = strControlInfo(j, 1, i)
.DescriptionText = strControlInfo(j, 2, i)
.Enabled = True
.FaceId = strControlInfo(j, 3, i)
.Height = strControlInfo(j, 4, i)
'.ID = strControlInfo(j, 5, i)
.OnAction = strControlInfo(j, 6, i)
.Parameter = strControlInfo(j, 7, i)
.Priority = strControlInfo(j, 8, i)
.ShortcutText = strControlInfo(j, 9, i)
.State = strControlInfo(j, 10, i)
.Style = strControlInfo(j, 11, i)
.Tag = strControlInfo(j, 12, i)
.TooltipText = strControlInfo(j, 13, i)
.Width = strControlInfo(j, 14, i)
End With
.Visible = True
End With
End If
y = y + 1
Next j
i = i + 1
Next x