View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SteveDB1[_2_] SteveDB1[_2_] is offline
external usenet poster
 
Posts: 1
Default UIRibbon/VBA/XML question

morning all.
I've been trying to modify my ribbon menu to include a gallery because of
the amount of data I want to place in the gallery-- a 6 x 6 arrayed layout as
opposed to the standard vertical list (I've got a few others that I'd like
arrayed in a gallery as well, so this will be the first of 3 or 4 galleries I
want, perhaps more).
While I've gotten the gallery to display correctly, I have no idea how to
create the macro to activate the individual elements for the gallery itself.

I've done some digging around on the various blogs, discussions, MSDN
libraries, etc.... the MS developers have on galleries, and I either don't
understand what they're saying, or they're not concise enough for me to "get
it."

So, I'm here, hat in hand, asking for your help.

I've found the following code for VBA that appears to link a 12 month
gallery to the xml code, and each of the 12 months' names shown in the
gallery. With my modifications of course-- or my attempts at modifying it.
-----------------------------
Sub InsertSectNo(Control As IRibbonControl, selectedId As String,
selectedIndex As Integer)

Dim text As String
Dim SectionName() As String
Select Case Control.ID
Case "GalleryA"
text = SectionName(selectedIndex + 1)
'I'm guessing here, and am not sure that this would be what I'd need.
End Select
Selection.InsertAfter text
'again, not sure if this is what I'd need. My goal is to have the value of
'the choice
'input into an excel cell where my cursor is located.

End Sub
--------------------------
And below is a single sample of 36 macros that I WAS using for my
"SectionName" macros before the idea for wanting a gallery came into play.
-------------------------
Sub Sect01(Control As IRibbonControl)
ActiveCell.FormulaR1C1 = "1"
With ActiveCell.Characters(Start:=1, Length:=5).Font
End With
End Sub

The Sect01 macro is to link back to the InsertSectNo macro so that when I
click on 1 in my gallery it'll insert the number 1 in to the destination
cell. And if I select 36, or some number-- that I've selected-- in between 1
and 36, it'll insert that number in to the selected cell.
6 5 4 3 2 1
7 8 9 10 11 12
18 17 16 15 14 13
19 20 21 22 23 24
30 29 28 27 26 25
31 32 33 34 35 36

is the configuration of my array in the ribbon.
please advise if you require further info or clarification.
Thank you.