Excel VBA Ribbon - Set value of editBox on Startup Based on Value on Worksheet

286 Views Asked by At

I have an editBox on an Excel File where I want to display a date that is stored in a named cell on a specific worksheet. I want this value to be displayed when the Excel file is opened.

Here's the ribbon XML line:

<editBox id="editBoxSDate" label = "S Date" onChange = "onChange_SDate" getText = "getText_SDate"/>

Here's the getText_SDate function:

Public Function getText_SDate(ByRef control As Office.IRibbonControl) As String
    getText_SDate = CStr(wksSettings.Range("SettingsSDate"))
End Function

When I open the file and click on my custom Ribbon tab, I get the following error message: Wrong number of arguments or invalid property assignment

What am I missing or doing wrong?

1

There are 1 best solutions below

1
EEM On

Either change the name of the Function or the getText command to match, actually they do not match, i.e.: getText_Date vs.getText_SDate