Bonjour a tous,
Apres 3 jours de galere pour la programmation d'un menu dynamique, je suis contraint de m'en remettre a vous pour un coup de main.
Voici le code XML du menu dynamique:
la procedure de callback:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <group id="grpContrats" label="Contrats"> <dynamicMenu id="dynMenu" label="Contrats" size="large" getContent="callback_Menu" imageMso="HappyFace"/> </group>
et le code XML obtenu par debug.print strXML:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 Sub callback_Menu(control As IRibbonControl, ByRef strXML) Dim strSQL As String Dim rst As DAO.Recordset Dim intI As Integer 'debut de la declaration du menu strXML = "<menu xmlns=""http://shemas.microsoft.com" _ & "/office/2006/01/customui"" itemSize=""normal"">" strSQL = "SELECT * FROM [tbl_Contrats]" Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset) intI = 1 While Not rst.EOF 'creer un bouton pour chaque contrats strXML = strXML & "<button id=""dynbtn" & intI & """" _ & " label=""" & rst("cont intervenant") _ & " " & rst("cont lot") & """" _ & " onAction=""dynMenu_onAction""" _ & " imageMso=""PictureEffectsShadowGallery"" />" 'contrat suivant rst.MoveNext intI = intI + 1 Wend rst.Close Set rst = Nothing 'fin du menu strXML = strXML & "</menu>" Debug.Print strXML End Sub
J'ai essayé tout ce qui était de mes compétences, mais rien ca ne fonctionne pas.Le menu reste desesperement vide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <menu xmlns="http://shemas.microsoft.com/office/2006/01/customui" itemSize="normal"> <button id="dynbtn1" label="7 25" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn2" label="3 3" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn3" label="4 6" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn4" label="5 5" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn5" label="6 7" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn6" label="8 10" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn7" label="9 11" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn8" label="10 12" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn9" label="11 13" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn10" label="12 14" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn11" label="13 15" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn12" label="14 16" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn13" label="15 17" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn14" label="16 18" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn15" label="17 20" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn16" label="18 21" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn17" label="19 22" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn18" label="117 24" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> <button id="dynbtn19" label="117 24" onAction="dynMenu_onAction" imageMso="PictureEffectsShadowGallery" /> </menu>
Je n'arrive pas a trouver l'eereur.
Merci a tous ceux qui pourront m'aider.
Partager