1

The code that follows works perfectly in Excel 2013 and prior, but upon installing Excel 2016 (via Office 365 subscription) and opening one of my workbooks with custom ribbon tools, I get a "Can't find Library" error. ( there are no missing references)

Here is one sample Sub (dropdown control in ribbon) where the error pops up. The error is on the Call, where it doesn't like returnedVal.

'Callback for rxdrdnAcctName onAction
Sub rxdrdnAcctName_Click(control As IRibbonControl, id As String, index As Integer)
    On Error Resume Next
    Call rxDropDownItemLabel(control, index, returnedVal)    

    Sheets("Tables").Range("AcctNametoPlot").Value = returnedVal
    If Err.Number <> 0 Then
        LogError(Now & "...RibbonTool--> " & Err.Description)
    End If
End Sub

Here is the code for the sub getting called

'Callback for rxdrdnAcctName getItemLabel
Sub rxDropDownItemLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
    Dim varItems As Variant
    If (control.id = "rxdrdnAcctName" Or control.id = "rxdrdnNewAcctName") Then
        varItems = ThisWorkbook.Sheets("Tables").Range("SortedAcctList").Value
    ElseIf (control.id = "rxdrdnYear" Or control.id = "rxdrdnNewAcctYear") Then
        varItems = ThisWorkbook.Sheets("Tables").Range("YearsList").Value
    ElseIf control.id = "rxdrdnMonth" Then
        varItems = ThisWorkbook.Sheets("Tables").Range("MonthNames").Value
    ElseIf control.id = "rxdrdnCommod" Then
        varItems = ThisWorkbook.Sheets("Tables").Range("CommodityPLNamesList").Value
    ElseIf control.id = "rxdrdnSheetSelectName" Then
        varItems = ThisWorkbook.Sheets("Tables").Range("AllSheetsNames").Value
    End If
    returnedVal = varItems(index + 1, 1)
End Sub

What has changed in Excel 2016 (for customizing the ribbon) that has broken this code?

dinotom
  • 4,990
  • 16
  • 71
  • 139
  • If you add `Option Explicit` to all modules, does your code compile? (Debug / Compile) -- And which line is highlighted when the error occurs? – Andre Aug 08 '16 at 12:30
  • @Andre...added more info in original post. I always use Option Explicit in every module. – dinotom Aug 08 '16 at 12:36
  • 1
    Where is `returnedVal` declared before you try and pass it to the `rxDropDownItemLabel` routine? – Rory Aug 08 '16 at 12:40
  • @Rory...Private returnedVal as String...declared at top of module...but your missing the point, this code works fine in Excel 2007-2013 – dinotom Aug 08 '16 at 12:51
  • Custom ribbon tool doesn't work with office -16. Use other tools. – cyboashu Aug 08 '16 at 13:01
  • 1
    Uh, doesn't it? https://support.office.com/en-us/article/Customize-the-ribbon-in-Office-00f24ca7-6021-48d3-9514-a31a460ecb31 – Tom K. Aug 08 '16 at 13:11
  • Doesn't seem like the underlying CustomUI XML spec has changed or become incompatible with the release of 2016 (https://msdn.microsoft.com/en-us/library/dd944957(v=office.12).aspx) – Mikegrann Aug 08 '16 at 14:33

0 Answers0