{"id":13706439,"url":"https://github.com/pgeerkens/PGSolutions.BetterRibbon","last_synced_at":"2025-05-05T20:31:11.112Z","repository":{"id":217171905,"uuid":"153345566","full_name":"pgeerkens/PGSolutions.BetterRibbon","owner":"pgeerkens","description":"The Fluent Ribbon - done right. Generic dispatcher to greatly ease Ribbon development in both .NET \u0026 VBA","archived":false,"fork":false,"pushed_at":"2019-03-08T20:40:32.000Z","size":17263,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-13T14:43:18.454Z","etag":null,"topics":["excel-links-analysis","exporting-vba","ribbon-controls","ribbon-interface","vba"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgeerkens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-16T19:52:40.000Z","updated_at":"2024-03-27T16:17:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"87c22dc4-7e6f-4035-a343-ba2cb9c45ad7","html_url":"https://github.com/pgeerkens/PGSolutions.BetterRibbon","commit_stats":null,"previous_names":["pgeerkens/pgsolutions.betterribbon"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgeerkens%2FPGSolutions.BetterRibbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgeerkens%2FPGSolutions.BetterRibbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgeerkens%2FPGSolutions.BetterRibbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgeerkens%2FPGSolutions.BetterRibbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgeerkens","download_url":"https://codeload.github.com/pgeerkens/PGSolutions.BetterRibbon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252570986,"owners_count":21769761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["excel-links-analysis","exporting-vba","ribbon-controls","ribbon-interface","vba"],"created_at":"2024-08-02T22:00:56.366Z","updated_at":"2025-05-05T20:31:11.096Z","avatar_url":"https://github.com/pgeerkens.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"# PGSolutions.BetterRibbon\n**The Fluent Ribbon - done right.  A generic dispatcher greatly easing Ribbon development in both .NET \u0026amp; VBA**\n\nTied up in knots programming the Fluent Ribbon? Wondering why you bought an MS-Office with no wiring at the front desk? Here is\nan example of how the Fluent Ribbon was **meant** to be delivered.\n\nThis solution uses generic callbacks eponymous with their XM tags, with a dictionary lookup on each callback invocation, to\nautomatically route each to its appropriate control. This implementation provides not just a pre-programmed ViewModel for all one's\nRibbon controls, but a Model template as well. \n\nThe supplied Add-In also comes with a built in suite of Ribbon controls that can be dynamically attached to:\n- 1 ToggleButton;\n- 3 CheckBoxes;\n- 3 DropDowns; and\n- 3 (Action)Buttons.\n\nThe code to activate one of the (Action)Buttons, with Click event handler programmed in VBA and custom text defined at\nrun time, is as simple as this, in three modules:\n\n**RibbonModel**, declaring, initializing and handling the events from the controls used:\n\n    Option Explicit\n    Private CustomGroup         As IGroupModel\n    Private WithEvents Button1  As ButtonModel\n    Attribute Button1.VB_VarHelpID = -1\n\n    Private Sub Button1_Clicked(ByVal control As IRibbonControl)\n        ButtonProcessing.Button1_Processing\n    End Sub\n\n    Private Sub Class_Initialize()\n        Dim Strings As IControlStrings\n        With ThisWorkbook.ModelServer\n            Set CustomGroup = .GetGroupModel(\"CustomizableGroup\")\n\n            Set Button1 = .GetButtonModel(\"CustomizableButton1\") _\n                          .SetImage(.NewImageObjectMso(\"MacroPlay\"))\n        End With\n    End Sub\n    \n**ResourceLoader**, supplying string and image resources to the dispatcher:\n\n    Option Explicit\n    Implements IResourceLoader\n\n    ''' \u003csummary\u003eServing Button, ToggleButton, CheckBox, Menu, and Gallery controls. \u003c/summary\u003e\n    Private Function IResourceLoader_GetControlStrings2(ByVal ControlId As String) As IControlStrings2\n        Select Case (ControlId)\n            Case \"CustomizableButton1\":\n                Set IResourceLoader_GetControlStrings2 = ThisWorkbook.ModelServer.NewControlStrings2( _\n                    Label:=\"This is cool!\", _\n                    ScreenTip:=\"VBA-Customized Button Screentip\", _\n                    SuperTip:=\"This button is completely\" \u0026 vbNewLine \u0026 _\n                              \"customized within the VBA\" \u0026 vbNewLine \u0026 _\n                              \"workbook.\", KeyTip:=\"\", Description:=\"\")\n            Case Else:\n                Set IResourceLoader_GetControlStrings2 = Nothing\n        End Select\n    End Function\n\n    ''' \u003csummary\u003eServing all other controls. \u003c/summary\u003e\n    Private Function IResourceLoader_GetControlStrings(ByVal ControlId As String) As IControlStrings\n        Select Case (ControlId)\n            Case \"CustomizableGroup\":\n                Set IResourceLoader_GetControlStrings = ThisWorkbook.ModelServer.NewControlStrings( _\n                    Label:=\"VBA Custom Controls\", _\n                    ScreenTip:=\"\", SuperTip:=\"\", KeyTip:=\"\")\n            Case Else:\n                Set IResourceLoader_GetControlStrings = Nothing\n        End Select\n    End Function\n\n    Private Function IResourceLoader_GetImage(ByVal Name As String) As Variant\n        IResourceLoader_GetImage = \"MacroSecurity\"\n    End Function\n\n    \nand **ThisWorkbook**, initializng the connection to the dispatcher.\n\n    Option Explicit\n    Private Const COMAddInName  As String = \"PGSolutions.BetterRibbon\"\n    Private MModelServer        As IModelServer\n    Private MRibbonModel        As RibbonModel\n\n    Public Function ModelServer() As IModelServer\n        If MModelServer Is Nothing Then\n            Set MModelServer = Application.COMAddIns(COMAddInName).Object _\n                    .NewBetterRibbon(New ResourceLoader)\n        End If\n        Set ModelServer = MModelServer\n    End Function\n\n    Private Sub Workbook_Activate()\n        If MRibbonModel Is Nothing Then\n            Application.COMAddIns(COMAddInName).Object.RegisterWorkbook ThisWorkbook.Name\n            Set MRibbonModel = New RibbonModel\n        End If\n    End Sub\n\n    ' Depending on Workbook location, pops-up a dialog to assist with setting debug breakpoints.\n    Private Sub Workbook_Open()\n        If DeskTop(False) = \"D:\\Users\\Pieter\\Desktop\\\" _\n        Or ThisWorkbook.Path = DeskTop(True) \u0026 \"Example Workbooks\" _\n        Or ThisWorkbook.Path = DeskTop(False) \u0026 \"Example Workbooks\" Then _\n            MsgBox \"Pause for Ctrl-Break to ease debugging.\" \u0026 vbNewLine \u0026 vbNewLine \u0026 _\n                   \"This message can be disabled by moving the workbook\" \u0026 vbNewLine \u0026 _\n                   \"out of the Desktop folder 'Example Workbooks'.\", _\n                   vbOKOnly, ThisWorkbook.Name\n    End Sub\n\nThe *Workbook_Activate* event is programmed as the controls for this workbook are automatically deactivated when the workbook loses\nfocus. So the preprogrammed customizable controls from the Add-In are all available to every workbook.\n\n---\n\nAlso included:\n\n1. VBA Source Exporter that unloads all VBA code for an MS-Excel or MS-Access project to a directory sibling to the workbook/database;\n named either eponymously with the suffix VBA or *.\\src*. A great time saver for managing VBA code in source control. There is a Ribbon Group in the Add-In with three controls accessing this functionality:\n\n - A **Toggle** between use of the directory *'\\src* and a directory eponymouswith the workbook/database name.\n - A **Selected Projects** (Action)Button for exporting VBA code from a directory of projects.\n - A **Current Workbook** (Action)Button that immediately exports the VBA code from the current workbook.\n\n1. External Links Analyzer that collects details on all External Links in a list of Workbooks, and reports them to three worksheets in\nthe current worlkbook: *Links Analysis*, *Externally Linked Files List*, and *Parsing Failures*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgeerkens%2FPGSolutions.BetterRibbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgeerkens%2FPGSolutions.BetterRibbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgeerkens%2FPGSolutions.BetterRibbon/lists"}