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
C'est okre
VB:If RunMacScript = "true" Then MsgBox "un projet portant ce Nom exite deja" Set DocXml = Nothing clearvisual ThisWorkbook.Sheets("param").[H2:H3] = "" Exit Function End If
Function RegMacCSVproject(csvcode)
Dim Nom As String, folderAllproject As String, x As Long, fold, fich, RunMacScript As String, rewrite&, Q&
If ThisWorkbook.Sheets("param").[h2] = "" Then
rewrite = 0
folderAllproject = ThisWorkbook.Path & Application.PathSeparator & "Mes Projets"
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFolder", folderAllproject)
Nom = InputBox("Entrez un nom pour ce projet", "ouverture de nouveau projet", "myproject")
fold = folderAllproject & Application.PathSeparator & "Projet_" & Nom
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFolder", fold)
fich = fold & Application.PathSeparator & Nom & ".csv"
ThisWorkbook.Sheets("param").[h2] = fold
ThisWorkbook.Sheets("param").[H3] = Nom & ".csv"
Else
rewrite = 2
With ThisWorkbook.Sheets("param"): fich = .[h2] & Application.PathSeparator & .[H3]: End With
End If
If rewrite = 2 Then
' Kill fich
'RunMacScript = AppleScriptTask("myScriptUI.scpt", "DeleteFile", fich)
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFileContentsUTF8", csvcode & "|" & fich)
Else
'If Dir(fich) <> "" Then MsgBox "un projet portant ce Nom exite deja": Exit Function
RunMacScript = AppleScriptTask("myScriptUI.scpt", "FileExists", fich)
If RunMacScript = "true" Then
Q = MsgBox("un projet portant ce Nom existe deja" & vbcrlf & "Voulez vous ecraser l'existant", vbYesNo + vbCritical)
If Q = vbNo Then
Set DocXml = Nothing
clearvisual
ThisWorkbook.Sheets("param").[H2:H3] = ""
Exit Function
Else
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFileContentsUTF8", csvcode & "|" & fich)
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
End If
End If
End If
End Function
Function RegCSVproject(csvcode)
'patricktoulon
Dim Nom As String, folderAllproject As String, x As Long, fold, fich, rewrite&, Q&
If ThisWorkbook.Sheets("param").[h2] = "" Then
rewrite = 0
folderAllproject = ThisWorkbook.Path & Application.PathSeparator & "Mes Projets"
If Dir(folderAllproject, vbDirectory) = "" Then MkDir folderAllproject
Nom = InputBox("Entrez un nom pour ce projet", "ouverture de nouveau projet", "myproject")
fold = folderAllproject & Application.PathSeparator & "Projet_" & Nom
If Dir(fold, vbDirectory) = "" Then: MkDir fold
fich = fold & Application.PathSeparator & Nom & ".csv"
ThisWorkbook.Sheets("param").[h2] = fold
ThisWorkbook.Sheets("param").[H3] = Nom & ".csv"
Else
rewrite = 2
With ThisWorkbook.Sheets("param"): fich = .[h2] & Application.PathSeparator & .[H3]: End With
End If
If rewrite = 2 Then
Kill fich
SaveFileUTF_8 csvcode, fich
Else
If Dir(fich) <> "" Then
Q = MsgBox("un projet portant ce Nom existe deja" & vbcrlf & "Voulez vous ecraser l'existant", vbYesNo)
If Q = vbNo Then
Set DocXml = Nothing
clearvisual
ThisWorkbook.Sheets("param").[H2:H3] = ""
Exit Function
Else
SaveFileUTF_8 csvcode, fich
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
End If
End If
End If
End Function
Function RegMacCSVproject(csvcode)
Dim Nom As String, folderAllproject As String, x As Long, fold, fich, RunMacScript As String, rewrite&, Q&
If ThisWorkbook.Sheets("param").[h2] = "" Then
rewrite = 0
folderAllproject = ThisWorkbook.Path & Application.PathSeparator & "Mes Projets"
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFolder", folderAllproject)
Nom = InputBox("Entrez un nom pour ce projet", "ouverture de nouveau projet", "myproject")
fold = folderAllproject & Application.PathSeparator & "Projet_" & Nom
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFolder", fold)
fich = fold & Application.PathSeparator & Nom & ".csv"
ThisWorkbook.Sheets("param").[h2] = fold
ThisWorkbook.Sheets("param").[H3] = Nom & ".csv"
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFileContentsUTF8", csvcode & "|" & fich)
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
Exit Function
Else
rewrite = 2
With ThisWorkbook.Sheets("param"): fich = .[h2] & Application.PathSeparator & .[H3]: End With
End If
If rewrite = 2 Then
' Kill fich
'RunMacScript = AppleScriptTask("myScriptUI.scpt", "DeleteFile", fich)
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFileContentsUTF8", csvcode & "|" & fich)
Else
'If Dir(fich) <> "" Then MsgBox "un projet portant ce Nom exite deja": Exit Function
RunMacScript = AppleScriptTask("myScriptUI.scpt", "FileExists", fich)
If RunMacScript = "true" Then
Q = MsgBox("un projet portant ce Nom existe deja" & vbxclf & "Voulez vous ecraser l'existant", vbYesNo + vbCritical)
If Q = vbNo Then
Set DocXml = Nothing
clearvisual
ThisWorkbook.Sheets("param").[H2:H3] = ""
Exit Function
Else
RunMacScript = AppleScriptTask("myScriptUI.scpt", "CreateFileContentsUTF8", csvcode & "|" & fich)
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
End If
End If
End If
End Function
Function RegCSVproject(csvcode)
'patricktoulon
Dim Nom As String, folderAllproject As String, x As Long, fold, fich, rewrite&, Q&
If ThisWorkbook.Sheets("param").[h2] = "" Then
rewrite = 0
folderAllproject = ThisWorkbook.Path & Application.PathSeparator & "Mes Projets"
If Dir(folderAllproject, vbDirectory) = "" Then MkDir folderAllproject
Nom = InputBox("Entrez un nom pour ce projet", "ouverture de nouveau projet", "myproject")
fold = folderAllproject & Application.PathSeparator & "Projet_" & Nom
If Dir(fold, vbDirectory) = "" Then: MkDir fold
fich = fold & Application.PathSeparator & Nom & ".csv"
ThisWorkbook.Sheets("param").[h2] = fold
ThisWorkbook.Sheets("param").[H3] = Nom & ".csv"
SaveFileUTF_8 csvcode, fich
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
Exit Function
Else
rewrite = 2
With ThisWorkbook.Sheets("param"): fich = .[h2] & Application.PathSeparator & .[H3]: End With
End If
If rewrite = 2 Then
Kill fich
SaveFileUTF_8 csvcode, fich
Else
If Dir(fich) <> "" Then
Q = MsgBox("un projet portant ce Nom existe deja" & vbCrLf & "Voulez vous ecraser l'existant", vbYesNo)
If Q = vbNo Then
Set DocXml = Nothing
clearvisual
ThisWorkbook.Sheets("param").[H2:H3] = ""
Exit Function
Else
SaveFileUTF_8 csvcode, fich
MsgBox "projet demarre" & vbCrLf & " Toutes modifications sera automatiquement enregistree dans le projet Csv"
End If
End If
End If
End Function
voilà insérer … bien sur j'ai pas les callbacks car j'ai créé un xlsm vierge … mis en ziple dossier