2021年3月12日星期五

where to write callback functions for custom ribbon

I have a custom ribbon which has only 1 button as a test, when i use a macro in the onAction attribute it works just fine but when i add a normal callback function i wrote it just can't find it. so the question is where to write these callbacks (in my case i made a module and made my callback function a public sub in that module).

here is the xml code:

    <Relationship Id="customUIRelID" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/customUI.xml"/>      <ribbon startFromScratch="true">          <tabs>              <tab id="CustomTab" label="My Tab">                  <group id="SimpleControls" label="My Group">                      <button id="Button1" imageMso="HappyFace" size="large" label="Large Button" onAction="ribbonOpenForm"/>                  </group>              </tab>          </tabs>      </ribbon>  </customUI>   

and the callback function is :

Public Sub ribbonOpenForm(control As IRibbonControl)      Dim formName As String      formName = control.Tag      If formName = "" Then          MsgBox "No Name"          Exit Sub      End If      DoCmd.OpenForm formName  End Sub  

when i add a smale edit in the xml code which is : onAction="ribbonOpenForm" i get a new error.

the first error:

enter image description here

the error after the edit:

enter image description here

https://stackoverflow.com/questions/66602523/where-to-write-callback-functions-for-custom-ribbon March 12, 2021 at 11:12PM

没有评论:

发表评论