RibbonX Dropdown Problem
28.06.2013 14:56:22
Martin
es ist mir mit dem ribbonX workshop gelungen, danke rene, recht ordentliche ribbons zu erstellen. nun habe ich noch mit dem dropdown ein grosses problem. ich moechte nur jene tabellenblaetter im dropdown anzeigen, welche mit dem namen "Sector ID" beginnen. im workbook sind etliche andere sheets mit div namen, und dann sector id sheets mit einer nummer hinten dran (ab und zu sind gar keine sector id sheets vorhanden).
ich habe es schon geschafft, den ItemCount zu bewerkstelligen, der zaehlt richtig, und es werden auch entsprechend der anzahl der sector id blaetter dies anzahl im drop down dargestellt.
nun bin ich nach ca 9 std herumprobieren etwas verzweifelt, dass ich die loesung nicht finde. wenn ich das habe, waere mein projekt erfolgreich abgeschlossen!
anbei der teil des vba codes und der xml code.
ich bedanke mich im voraus fuer eure hilfe!
liebe gruesse,
martin
Sub dropDown_ItemCount(control As IRibbonControl, ByRef returnValue)
Dim i%
Dim ws As Worksheet
i = 0
For Each ws In ActiveWorkbook.Worksheets
If Left(ws.Name, 9) = "Sector ID" Then i = i + 1
Next
returnValue = i
End Sub
Sub dropDown_ItemID(control As IRibbonControl, Index As Integer, ByRef returnValue)
Dim i%
Dim ws As Worksheet
i = 0
For Each ws In ActiveWorkbook.Worksheets
If Left(ws.Name, 9) = "Sector ID" Then i = i + 1
Next
returnValue = ThisWorkbook.Sheets(Index + i).Name
End Sub
Sub dropDown_ItemLabel(control As IRibbonControl, Index As Integer, ByRef label)
Dim i%
Dim ws As Worksheet
i = 0
For Each ws In ActiveWorkbook.Worksheets
If Left(ws.Name, 9) = "Sector ID" Then i = i + 1
Next
label = ThisWorkbook.Sheets(Index + i).Name
End Sub
Sub dropDown_onAction(control As IRibbonControl, id As String, Index As Integer)
Sheets(id).Activate
End Sub
/pre>
customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
onLoad="onload">
ribbon startFromScratch="false">
tabs>
tab id="tab01" label="SPOC-Contingency">
group id="grp01" label="SPOC" >
button id="tgb01" label="Create Files" imageMso="SharePointListsWorkOffline"
onAction="CopyCurrentData"
size="large"/>
/group>
group id="grp02" label="SPOC-Print">
button id="tgb02" label="SPOC Sector" imageMso="FilePrint"
onAction="Drucken"
size="large"/>
button id="tgb03" label="SPOC Task" imageMso="FilePrint"
onAction = "Ausdrucken"
size="large"/>
/group>
group id="grp03" label="Sector ID" >
button id="tgb04" label="SPOC Sector" imageMso="WindowSwitchWindowsMenuExcel"
onAction="SectorID"
size="large"/>
dropDown id="PrintSectorID" label="Print Sector ID:" screentip="Choose your Sector ID - Sheet "
supertip="Select the Sector ID sheet you want to print" sizeString="xxxxxxxxxxxxxxx"
onAction="dropDown_onAction" getItemCount="dropDown_ItemCount" getItemID ="dropDown_ItemID" _
getItemLabel="dropDown_ItemLabel">
/dropDown>
/group>
/tab>