Simplify call from ribbon #489
Replies: 1 comment 1 reply
-
Hi Josef, Thanks for sharing this suggestion! You are right that this syntax of calling the add-in name without the extension, followed by the public function both loads the add-in and calls the function. This was something I tried to figure out in the past, but the closest I had gotten was the call to load the add-in. Thank you so much for sharing this tip!! In my testing, I am able to successfully call the add-in even with a space in the file name. I have tested this on both accdb and adp projects in Access 2010 and it works great! GetObject(,"Access.Application").run Environ$("AppData") & "\MSAccessVCS\Version Control.HandleRibbonCommand", "btnShow"
I will plan to update the code base to transition to this simpler and cleaner approach to calling the add-in. Also, I don't think I quite understood your comment about "no identifying string" in the file name... Were you referring to the fact that "Version Control" is a very generic name? I like your suggestion of P.S. |
Beta Was this translation helpful? Give feedback.
-
Is there a specific reason for the file name "Version Control.accda" (with spaces and no identifying string)?
If the name did not contain a space, it would be much easier to call up via the ribbon. I would use the name msaccess-vcs.accda.
You could use
Application.Run "{Path}\{FileName without extension}.HandleRibbonCommand"
directly and would not have to make sure that the appropriate VBProject is active in order to be able to callHandleRibbonCommand
.Example code: https://github.com/josef-poetzl/msaccess-vcs-addin/blob/Simplify-call-from-ribbon/Ribbon/Source/Sources/AddInRibbon.twin#L151
Beta Was this translation helpful? Give feedback.
All reactions