Home > Software design >  Calling a RibbonControl function from a userform
Calling a RibbonControl function from a userform

Time:03-05

I recently asked a question about how to go about producing a dynamic toolbar in MS Word which I finally have working. However I have a set of variables which are produced in a userform, from which I want to call a function in the parent module to invalidate the UI in order to refresh the visibility of buttons dependent on the information input in the userform.

In the userform I have the following where i is part of a for loop to cycle through dynamically:

Call Reintialise ("emailCheck"&i)

Then in the module I have

Sub Reintialise(control As IRibbonControl, check As String)
   IRibbon.InvalidateControl (check) 
End Sub

I get the error: 'Argument not optional' which I know comes from not having two arguments in the call of the function but I'm not sure what to put in for control, 1, true, leaving it blank are all type mismatches

Many thanks,

CodePudding user response:

Passing Nothing as the control parameter will trigger the method.

Reintialise Nothing, "emailCheck" & i
  • Related