View Single Post
 
Old 02-24-2023, 06:55 AM
Ddadoo57 Ddadoo57 is offline Windows 11 Office 2021
Advanced Beginner
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default

Here is a possible solution to adapt it. It seems to work (see in time)

Here are the lines I modified to adapt them to Word

So I put in the declaration :
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As LongPtr)

In: Sub RibbonLoaded_MyCustomAddin(ribbon As IRibbonUI)
ThisDocument.Variables("RibbonID") = StoreRibbonPointer
ThisDocument.Saved = True


In: Sub RefreshRibbon()
I deleted: 'Dim objRibbon As Object
I put this: Set objRibbon = GetRibbon(Replace(ActiveDocument.Variables("Ribbon ID"), "=", ""))

Now I can call "Call RefreshRibbon" it seems where I want, in my case in the Callback of onAction of my ToggleButtons. For the moment it seems to work and moreover I can modify on the fly the vba code of the Ribbon without it crashing either! (
Reply With Quote