Search code examples
vbaexcelribbonx

Excel Custom Ribbon button calling subroutines for other ribbon buttons


If i set up a subroutine so that it can be called from a customer ribbon button is it still possible to call those subroutines from other subroutines? I'm getting the argument not optional error message but I'm not sure what argument to pass to the subroutine since I'm not calling then from the ribbon button but from inside another subroutine itself.

Sub Reset(ByVal Control As IRibbonControl)
    Call ResetForumlas
    Call ResetValues
End Sub

Sub ResetForumlas(ByVal Control As IRibbonControl)
    "Do some stuff"
End Sub

Sub ResetValues(ByVal Control As IRibbonControl)
    "Do Some more stuff"
End Sub

Thanks for the help.


Solution

  • Please try its with out the call. Like this

    Sub Reset(ByVal Control As IRibbonControl)
        ResetForumlas
        ResetValues
    End Sub
    
    Sub ResetForumlas(ByVal Control As IRibbonControl)
        "Do some stuff"
    End Sub
    
    Sub ResetValues(ByVal Control As IRibbonControl)
        "Do Some more stuff"
    End Sub