Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Calling a RibbonControl function from a userform

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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,

>Solution :

Passing Nothing as the control parameter will trigger the method.

Reintialise Nothing, "emailCheck" & i
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading