Anomalous Behavior of Sub with Optional String Parameter Activated by Toolbar Icon

I have a Sub that is normally called by clicking on an icon on a custom toolbar. I decided that I could make good use of this Sub in another way by calling it with an optional string parameter. And everything seemed to work fine with the new usage. But then I discovered that clicking on the toolbar icon no longer works properly. I’ve made this simplified version to illustrate the problem:

Sub OptName(Optional aName As String)

   If Not IsMissing(aName) Then
      MsgBox("Name is " & aName)
      MsgBox("Name is Missing!")
   End If

End Sub

Now, when I call this from another Sub, as in:


---- then I get:

Name is Missing!

But if I now simply click on the toolbar icon, which calls the above Sub, I get this:

Name is 0

I don’t know whether to call this a bug or not, but either way, I’ve got to write code to work around this. (Not too difficult to do in any case.) I wonder if anyone else can replicate this problem? (I have LO Windows 11.)

I think it isn’t possible to call the Function with parameters by clicking on icon :-(.