Bonjour,
J'essaye de comprendre et d'adapter le code qui provient d'ici : http://codesnippets.services.openoffice.org/Office/Office.ContexMenuInterceptor.snip
Mais je bloque un peu..
Un des menu est ajouter par la ligne :
oMenuItem = GetSimpleMenuItem("Entry3", "Run the Snippet Creator", "macro:///SnippetCreator.Main.Main")
oATContainer.insertByIndex(2, oMenuItem)
Et la fonction GetSimpleMenuItem est la suivante :
Function GetSimpleMenuItem( sName As String, sText As String, _
sCommandUrl As String, Optional sHelpUrl As String ) As Object
Dim oPropSet As Object
Dim sInternalName As String
sInternalName = MNU_PREFIX & sName
If oPropSetRegistry.hasByName(sInternalName) Then
oPropSetRegistry.removePropertySet(sInternalName)
End If
oPropSet = oPropSetRegistry.openPropertySet(sInternalName, True)
oPropSet.addProperty("Text", 0, sText)
oPropSet.addProperty("CommandURL", 0, sCommandUrl)
If Not IsMissing(sHelpUrl) Then
oPropSet.addProperty("HelpURL", 0, sHelpUrl)
End If
GetSimpleMenuItem = oPropSet
End Function
Ce que je ne comprend pas c'est comment fonctionne la fonction addProperty qui ajoute la CommandURL. A quoi correspond cette Command URL ?? À la macro à lancer par ce menu ??
Car j'ai essayé de changer le paramètre "macro:///SnippetCreator.Main.Main" mais pour l'instant sans succés :(
Si quelqu'un a des renseignements sur le sujet….
Merci d'avance.