Sub Add_AddIn() 'version Mac (peut être PC aussi pouvez vous confirmer SVP)
Dim addInPath As String
addInPath = "MonChemin/TEST.xlam"
AddIns.Add addInPath
AddIns("TEST").Installed = True '
End Sub
function Admissibleelement(child,par)
select case child.tagname
case "tab"
" tabs " like "* " & par.tagname
case "goup"
" tab " like "* " & par.tagname
case "box"
" group " like "* " & par.tagname
case " button "
" group menu dropdown box buttongroup " like "* " & par.tagname
'etc..
end select
end function
Sub CheckFileHide()
Dim MyFileRel As String
MyFileRel = "Chemin_Du_Dossier_Rels" & Application.PathSeparator & ".rels"
requestFileAccess MyFileRel
If FindFileHide(MyFileRel) Then
MsgBox "OK"
End If
End Sub
Function FindFileHide(FilenameHide As String) As Boolean
FindFileHide = Dir(FilenameHide, vbDirectory + vbHidden) <> ""
End Function
Sub requestFileAccess(Fichier As String)
Dim fileAccessGranted As Boolean, filePermissionCandidates
filePermissionCandidates = Array(Fichier)
fileAccessGranted = GrantAccessToMultipleFiles(filePermissionCandidates)
End Sub
Sub LaunchWriteRel()
Dim FilePathRel As String
FilePathRel = "Chemin_Du_Dossier_Rels" & Application.PathSeparator & ".rels"
WriteRel FilePathRel
End Sub
Function WriteRel(PathOfRel As String)
Dim Channel As Long, AddToRel As String, OldRel As String, TbRel, i As Integer, NewRel As String
AddToRel = "<Relationship Id=""custo2007"" Type=""http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"" Target=""customUI/customUI.xml""/>" & vbCr & _
"<Relationship Id=""custo14"" Type=""http://schemas.microsoft.com/office/2007/relationships/ui/extensibility"" Target=""customUI/customUI14.xml""/>"
Channel = FreeFile
Open PathOfRel For Input As Channel
OldRel = Input(LOF(Channel), Channel): Close Channel
TbRel = Split(OldRel, ">")
For i = LBound(TbRel) + 1 To UBound(TbRel) - 1
If i = 1 Then
NewRel = TbRel(0) & ">" & vbCr & TbRel(i) & ">" & vbCr & AddToRel
Else
NewRel = NewRel & vbCr & TbRel(i) & ">"
End If
Next
Open PathOfRel For Output As Channel
Print #Channel, NewRel: Close Channel
End Function
Function WriteRel(PathOfRel As String)
Dim Channel As Long, AddToRel As String, OldRel As String, TbRel, i As Integer, NewRel As String
AddToRel = "<Relationship Id=""custo2007"" Type=""http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"" Target=""customUI/customUI.xml""/>" & vbCr & _
"<Relationship Id=""custo14"" Type=""http://schemas.microsoft.com/office/2007/relationships/ui/extensibility"" Target=""customUI/customUI14.xml""/>"
Channel = FreeFile
Open PathOfRel For Input As Channel
OldRel = Input(LOF(Channel), Channel): Close Channel
TbRel = Split(OldRel, ">")
NewRel = TbRel(0) & ">" & vbCr & TbRel(1) & ">" & vbCr & AddToRel
For i = LBound(TbRel) + 2 To UBound(TbRel) - 1
NewRel = NewRel & vbCr & TbRel(i) & ">"
Next
Open PathOfRel For Output As Channel
Print #Channel, NewRel: Close Channel
End Function
Sub LaunchWriteRel()
Dim FilePathRel As String
FilePathRel = "Chemin_Du_Dossier_Rels" & Application.PathSeparator & ".rels"
WriteRel FilePathRel
End Sub
Function WriteRel(PathOfRel As String)
Dim Channel As Long, AddToRel As String, OldRel As String, TbRel, i As Integer, NewRel As String
AddToRel = "<Relationship Id=""custo2007"" Type=""http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"" Target=""customUI/customUI.xml""/>" & vbCr & _
"<Relationship Id=""custo14"" Type=""http://schemas.microsoft.com/office/2007/relationships/ui/extensibility"" Target=""customUI/customUI14.xml""/>"
Channel = FreeFile
Open PathOfRel For Input As Channel
OldRel = Input(LOF(Channel), Channel): Close Channel
If Not OldRel Like "*custo2007*custo14*" Then
TbRel = Split(OldRel, ">")
NewRel = TbRel(0) & ">" & vbCr & TbRel(1) & ">" & vbCr & AddToRel
For i = LBound(TbRel) + 2 To UBound(TbRel) - 1
NewRel = NewRel & vbCr & TbRel(i) & ">"
Next
Open PathOfRel For Output As Channel
Print #Channel, NewRel: Close Channel
MsgBox "Le fichier Rels est modifié"
Else
MsgBox "Rels déjà créé"
End If
End Function
Function AdmissibleElement(child, par)
Select Case child.tagName
Case "tabs"
if " ribbon " like "* " & par.tagName & " *" then Yxxxxxx
Case "tab"
if " tabs " like "* " & par.tagName & " *" then Yxxxxxx
Case "group"
if " tab " like "* " & par.tagName & " *" then Yxxxxxx
Case "box"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "buttonGroup"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "menu"
if " group box menu splitButton " like "* " & par.tagName & " *" then Yxxxxxx
Case "dynamicMenu"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "button"
if " group box buttonGroup dropDown menu " like "* " & par.tagName & " *" then Yxxxxxx
Case "splitButton"
if " group box buttongroup " like "* " & par.tagName & " *" then Yxxxxxx
Case "checkBox"
if " group box " like "* " & par.tagName & " *" then Yxxxxxx
Case "comboBox"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "dropDown"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "gallery"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "item"
if " gallery comboBox dropDown " like "* " & par.tagName & " *" then Yxxxxxx
Case "labelControl"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "separator"
if " group " like "* " & par.tagName & " *" then Yxxxxxx
Case "menuSeparator"
if " menu " like "* " & par.tagName & " *" then Yxxxxxx
Case Else
End Select
End Function
Public Sub Class_Initialize()
Set GetParentElem = New Collection
GetParentElem.Add " ", "customUI"
GetParentElem.Add " customUI ", "ribbon"
GetParentElem.Add " ribbon ", "tabs"
GetParentElem.Add " tabs ", "tab"
GetParentElem.Add " tab ", "group"
GetParentElem.Add " group ", "box"
GetParentElem.Add " group ", "buttonGroup"
GetParentElem.Add " group box menu splitButton ", "menu"
GetParentElem.Add " group ", "dynamicMenu"
GetParentElem.Add " group box buttonGroup dropDown menu ", "button"
GetParentElem.Add " group box buttongroup ", "splitButton"
GetParentElem.Add " group box ", "checkBox"
GetParentElem.Add " group ", "comboBox"
GetParentElem.Add " group ", "dropDown"
GetParentElem.Add " group ", "gallery"
GetParentElem.Add " gallery comboBox dropDown ", "item"
GetParentElem.Add " group ", "labelControl"
GetParentElem.Add " group ", "separator"
GetParentElem.Add " menu ", "menuSeparator"
End Sub
Pourquoi ?mais le custo2007 tu peux l'oublier à mon avis non ?
Public Function AdmissibleElement(tagname, par As ElementXml)
Dim C As Boolean
Select Case tagname
Case "customUI": C = True
Case "ribbon": C = True
Case "button": C = " group box buttonGroup dropDown menu " Like "* " & par.tagname & " *"
Case "group": C = " tab " Like "* " & par.tagname & " *"
Case "tabs": C = " ribbon " Like "* " & par.tagname & " *"
Case "tab": C = " tabs " Like "* " & par.tagname & " *"
Case "box": C = " group " Like "* " & par.tagname & " *"
Case "buttonGroup": C = " group " Like "* " & par.tagname & " *"
Case "menu": C = " group box menu splitButton " Like "* " & par.tagname & " *"
Case "dynamicMenu": C = " group " Like "* " & par.tagname & " *"
Case "splitButton": C = " group box buttongroup " Like "* " & par.tagname & " *"
Case "checkBox": C = " group box " Like "* " & par.tagname & " *"
Case "comboBox": C = " group " Like "* " & par.tagname & " *"
Case "dropDown": C = " group " Like "* " & par.tagname & " *"
Case "gallery": C = " group " Like "* " & par.tagname & " *"
Case "item": C = " gallery comboBox dropDown " Like "* " & par.tagname & " *"
Case "labelControl": C = " group " Like "* " & par.tagname & " *"
Case "separator": C = " group " Like "* " & par.tagname & " *"
Case "menuSeparator": C = " menu " Like "* " & par.tagname & " *"
Case Else: C = False
End Select
AdmissibleElement = C
End Function
Public Function AdmissibleElement(tagname, par As ElementXml)
Dim C As Boolean
Select Case tagname
Case "customUI": C = DocXml.Childnodes.Count = 0
Case "ribbon": C = DocXml.Childnodes.Count = 1
Case "tabs": C = " ribbon " Like "* " & par.tagname & " *"
Case "tab": C = " tabs " Like "* " & par.tagname & " *"
Case "group": C = " tab " Like "* " & par.tagname & " *"
Case "button": C = " group box buttonGroup dropDown menu " Like "* " & par.tagname & " *"
Case "box": C = " group " Like "* " & par.tagname & " *"
Case "buttonGroup": C = " group " Like "* " & par.tagname & " *"
Case "menu": C = " group box menu splitButton " Like "* " & par.tagname & " *"
Case "dynamicMenu": C = " group " Like "* " & par.tagname & " *"
Case "splitButton": C = " group box buttongroup " Like "* " & par.tagname & " *"
Case "checkBox": C = " group box " Like "* " & par.tagname & " *"
Case "comboBox": C = " group " Like "* " & par.tagname & " *"
Case "dropDown": C = " group " Like "* " & par.tagname & " *"
Case "gallery": C = " group " Like "* " & par.tagname & " *"
Case "item": C = " gallery comboBox dropDown " Like "* " & par.tagname & " *"
Case "labelControl": C = " group " Like "* " & par.tagname & " *"
Case "separator": C = " group " Like "* " & par.tagname & " *"
Case "menuSeparator": C = " menu " Like "* " & par.tagname & " *"
Case Else: C = False
End Select
AdmissibleElement = C
End Function
Pourquoi ?mais le custo2007 tu peux l'oublier à mon avis non ?
C'est exactement ce que je pensais dernièrement avec mon GetParentElem en Boleanla définitive sera celle là
VB:Public Function AdmissibleElement(tagname, par As ElementXml) Dim C As Boolean Select Case tagname Case "customUI": C = DocXml.Childnodes.Count = 0 Case "ribbon": C = DocXml.Childnodes.Count = 1 Case "tabs": C = " ribbon " Like "* " & par.tagname & " *" Case "tab": C = " tabs " Like "* " & par.tagname & " *" Case "group": C = " tab " Like "* " & par.tagname & " *" Case "button": C = " group box buttonGroup dropDown menu " Like "* " & par.tagname & " *" Case "box": C = " group " Like "* " & par.tagname & " *" Case "buttonGroup": C = " group " Like "* " & par.tagname & " *" Case "menu": C = " group box menu splitButton " Like "* " & par.tagname & " *" Case "dynamicMenu": C = " group " Like "* " & par.tagname & " *" Case "splitButton": C = " group box buttongroup " Like "* " & par.tagname & " *" Case "checkBox": C = " group box " Like "* " & par.tagname & " *" Case "comboBox": C = " group " Like "* " & par.tagname & " *" Case "dropDown": C = " group " Like "* " & par.tagname & " *" Case "gallery": C = " group " Like "* " & par.tagname & " *" Case "item": C = " gallery comboBox dropDown " Like "* " & par.tagname & " *" Case "labelControl": C = " group " Like "* " & par.tagname & " *" Case "separator": C = " group " Like "* " & par.tagname & " *" Case "menuSeparator": C = " menu " Like "* " & par.tagname & " *" Case Else: C = False End Select AdmissibleElement = C End Function