Custom Ribbon - Add a gallery to a dynamic menu

NotoriousPopol

Board Regular
Joined
Jun 28, 2016
Messages
192
Hi guys! SORRY I don't use the code balise cause it (seems) not to work with things like < /> ...

I'm working on Custom Ribbon atm, and I try to add a gallery to a dynamic menu. I think it is possible but my code doesnt work.

The goal : to have a gallery with dynamic row a column numbers.

Questions : do YOU think this is possible? If not, what alternatives? If yes, do you know what I'm doing wrong? Thanks!


This is what I use now :

CallBack for the Dynamic Menu (work fine with just simple buttons) :

Public Sub CreationMenuDynamique(ctl As IRibbonControl, ByRef content)

'ouverture de la balise menu
content = "<menu xmlns="" http:="" schemas.microsoft.com="" office="" 2006="" 01="" customui""="">"

'put the gallery
content = content & GoGallery

'fermeture de la balise
content = content & "</menu>"

Debug.Print content
End Sub

Code to build the gallery :

Private Function GoGallery() As String
Dim strTemp As String
Dim Ws As Worksheet
Dim i As Integer

' Insertion d'un titre de menu
strTemp = "<menuseparator id="" feuilles""="" title="">"

For i = 1 To 1
strTemp = strTemp & _
"<gallery "="" &="" _
CreationAttribut("id", "rxgal" & i) & " " & _
CreationAttribut("label", "MyGal" & i) & " " & _
CreationAttribut("columns", "3") & " " & _
CreationAttribut("rows", "5") & " " & _
CreationAttribut("imageMso", "HappyFace") & " " & _
CreationAttribut("getItemCount", "rxgal_getItemCount") & " " & _
CreationAttribut("getItemLabel", "rxgal_getItemLabel") & " " & _
CreationAttribut("getItemScreentip", "rxgal_getItemScreenTip") & " " & _
CreationAttribut("onAction", "rxgal_Click") & " " & _
CreationAttribut("size", "normal") & ">"
Next
strTemp = strTemp & "</gallery>"
GoGallery = strTemp
End Function<menuseparator id="" feuilles""="" title="">

Code the write attributes :

Code:
Function CreationAttribut(strAttribut As String, Donnee As String) As String
    CreationAttribut = strAttribut & "=" & Chr(34) & Donnee & Chr(34)
End Function
</menuseparator></menuseparator>
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi

See if the two workbooks below are useful:


  1. A dynamic ribbon menu. https://www.dropbox.com/s/3ik4e89fk3rhlbz/dynamic.xlsm?dl=0
  2. Two ribbon galleries. https://www.dropbox.com/s/n7b3o6z51cryplo/galleries.xlsm?dl=0

8pZER9m.jpg
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top