S
Summer
Help please - throwing myself in at deep end and dog paddling to create a
working Custom Tab with multiple dropdowns plus buttons!
I'm cobbling together a custom Tab but wanting multiple dropdowns (not just
one) and ideas on VBA of how to simplify all the dropdowns in the one Ribbon
Module. All my dropdowns have loaded in the TAB as they should but I'm just
not sure how to approach the VBA Ribbon Module to cope with multiple
Dropdown IDs and macros?
Based on Greg Maxey's dropdown sample - does anyone have any ideas how to
best simplify the module RibbonControl (Greg?) to incorporate ALL groupids:
DD DD1 DD2 in the VBA project? I'm going to have about 15 dropdowns all up -
my working macro Custom Tab."
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="Test" label="Test">
<group id="iTest"
label="iLabel">
<button id="Btn1" label="2
Spaces . ? ! Clean" size="large" image="image1" onAction="Doc_Clean"/>
<button
idMso="StylesModifyStyle" />
<dropDown id="DD" label="M1"
onAction="GetDDIndex" getItemCount= "GetDDCount" getItemLabel="GetDDLabels">
</dropDown>
<dropDown
id="DD1" label="M2" onAction="GetDDIndex" getItemCount= "GetDDCount"
getItemLabel="GetDDLabels">
</dropDown>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="Test" label="Test">
<group id="iTest"
label="iLabel">
<button id="Btn1" label="2
Spaces . ? ! Clean" size="large" image="image1" onAction="Doc_Clean"/>
<button
idMso="StylesModifyStyle" />
<dropDown id="DD" label="M1"
onAction="GetDDIndex" getItemCount= "GetDDCount" getItemLabel="GetDDLabels">
</dropDown>
<dropDown
id="DD1" label="M2" onAction="GetDDIndex" getItemCount= "GetDDCount"
getItemLabel="GetDDLabels">
</dropDown>
Et cetera....
Code Module which needs to be expanded on to include ALL the IDs for
dropdowns and Cases for the macros - Am I being too simplistic expecting the
macros to be sequential Macro1 to Macro50 and expecting to modify the DD
Id?:
Option Explicit
Sub GetDDIndex(ByVal control As IRibbonControl, selectedID As String, _
selectedIndex As Integer)
Select Case selectedIndex
Case 0
Macros.Macro1
Case 1
Macros.Macro2
Case 2
Macros.Macro3
Case 3
Macros.Macro4
Case 4
Macros.Macro5
Case 5
Macros.Macro6
Case 6
Macros.Macro7
End Select
End Sub
Sub GetDDCount(ByVal control As IRibbonControl, ByRef count)
count = 7
End Sub
Sub GetDDLabels(ByVal control As IRibbonControl, _
index As Integer, ByRef label)
Dim i As Long
For i = 0 To index
label = Choose(i + 1, "Clear Text", _
"Macro Clear FR", _
"Macro 3", _
"Macro 4", _
"Macro 5", _
"Macro 6", _
"Macro 7")
Next i
End Sub
Sub Doc_Clean(ByVal control As IRibbonControl)
Macros.Doc_Clean
End Sub
working Custom Tab with multiple dropdowns plus buttons!
I'm cobbling together a custom Tab but wanting multiple dropdowns (not just
one) and ideas on VBA of how to simplify all the dropdowns in the one Ribbon
Module. All my dropdowns have loaded in the TAB as they should but I'm just
not sure how to approach the VBA Ribbon Module to cope with multiple
Dropdown IDs and macros?
Based on Greg Maxey's dropdown sample - does anyone have any ideas how to
best simplify the module RibbonControl (Greg?) to incorporate ALL groupids:
DD DD1 DD2 in the VBA project? I'm going to have about 15 dropdowns all up -
my working macro Custom Tab."
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="Test" label="Test">
<group id="iTest"
label="iLabel">
<button id="Btn1" label="2
Spaces . ? ! Clean" size="large" image="image1" onAction="Doc_Clean"/>
<button
idMso="StylesModifyStyle" />
<dropDown id="DD" label="M1"
onAction="GetDDIndex" getItemCount= "GetDDCount" getItemLabel="GetDDLabels">
</dropDown>
<dropDown
id="DD1" label="M2" onAction="GetDDIndex" getItemCount= "GetDDCount"
getItemLabel="GetDDLabels">
</dropDown>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="Test" label="Test">
<group id="iTest"
label="iLabel">
<button id="Btn1" label="2
Spaces . ? ! Clean" size="large" image="image1" onAction="Doc_Clean"/>
<button
idMso="StylesModifyStyle" />
<dropDown id="DD" label="M1"
onAction="GetDDIndex" getItemCount= "GetDDCount" getItemLabel="GetDDLabels">
</dropDown>
<dropDown
id="DD1" label="M2" onAction="GetDDIndex" getItemCount= "GetDDCount"
getItemLabel="GetDDLabels">
</dropDown>
Et cetera....
Code Module which needs to be expanded on to include ALL the IDs for
dropdowns and Cases for the macros - Am I being too simplistic expecting the
macros to be sequential Macro1 to Macro50 and expecting to modify the DD
Id?:
Option Explicit
Sub GetDDIndex(ByVal control As IRibbonControl, selectedID As String, _
selectedIndex As Integer)
Select Case selectedIndex
Case 0
Macros.Macro1
Case 1
Macros.Macro2
Case 2
Macros.Macro3
Case 3
Macros.Macro4
Case 4
Macros.Macro5
Case 5
Macros.Macro6
Case 6
Macros.Macro7
End Select
End Sub
Sub GetDDCount(ByVal control As IRibbonControl, ByRef count)
count = 7
End Sub
Sub GetDDLabels(ByVal control As IRibbonControl, _
index As Integer, ByRef label)
Dim i As Long
For i = 0 To index
label = Choose(i + 1, "Clear Text", _
"Macro Clear FR", _
"Macro 3", _
"Macro 4", _
"Macro 5", _
"Macro 6", _
"Macro 7")
Next i
End Sub
Sub Doc_Clean(ByVal control As IRibbonControl)
Macros.Doc_Clean
End Sub