On Error Resume Next Err.Clear Set oFileSystem = CreateObject("Scripting.FileSystemObject") Set oFolder = oFileSystem.GetFolder(Catia.Parent.Path) Set EmptyPartFolder = oFileSystem.GetFolder(oFolder.ParentFolder.ParentFolder.Path & "\startup\templates") ' dossier relatif des modèles vides Set EmptyPartFile = oFileSystem.GetFile(EmptyPartFolder.Path & "\empty.CATPart") If Err.Number = 0 Then On Error GoTo 0 Set oEmptyPart = Catia.Documents.Open(EmptyPartFile.Path) MSGBOX oEmptyPart.Part.MainBody.Name ' ===>> juste pour voir si marche Select case LCase(oEmptyPart.Part.MainBody.Name) case "partbody" langue = "Anglais" case "hauptkörper" Then langue = "Allemand" 'case ....... ' ...etc... end select msgbox langue 'etc... et n'oublie pas de fermer le fichier ' oFileSystem.GetFile(EmptyPartFolder.Path & "\empty.CATPart") ouvert par ce code, ' de mettre tous les Sets à Nothing, etc... (comme d'hab, quoi) ... End if
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim toto As Boolean toto = -1 MsgBox CStr(toto) Select Case CStr(toto) Case "True" langue = "Anglais" Case "Vrai" langue = "Français" '... etc ... End Select MsgBox langue
On Error Resume Next toto = CStr(vbNo) / 0 ' on provoque ainsi forcément une erreur MsgBox Err.Description Select Case Err.Description Case "Division par zéro" langue = "Français" 'Case ... etc ... End Select On error Goro 0