Hi all,
I think I'm pretty close to figuring this one out, but I still need an experts opinion/advice:
Following xml is used:
<button id="rxCalculate"
label="Hiring Plan Calculate"
imageMso="RecurrenceEdit"
size="large"
onAction="rxbtnCalculate"
getEnabled ="rxCalculate_getEnabled"/>
Following VBA used:
'Callback for rxCalculate getEnabled
Sub rxCalculate_getEnabled(control As IRibbonControl, ByRef returnedVal)
Dim x As Boolean
Dim Worksheet As Worksheet
Dim CurrentWb As Workbook
Set CurrentWb = ActiveSheet.Parent
For Each Worksheet In CurrentWb
If Worksheet.Name = "Wkly. Sum." Then x = True
Next Worksheet
Select Case x
Case Is = True
returnedVal = True
Case Is = False
returnedVal = False
End Select
End Sub
Even if the code is ok, it wont work since there won't be any worksheet when the UI loads(only the application window). How should i proceed? Basically i want a specific ribbon button to be disabled when the current workbook doesnt contain a worksheet named "Wkly. Sum."
Thanks
Bookmarks