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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
'***************************************
' CATIA File Name filter
'
' created by pdubernet
'
'
' please contact your administrator or
' pdubernet@assystem.com
'***************************************
'Variable qui prend en entrée les valeurs (A1, B1 / A2, B2 / ...An, Bn)
Dim strNameOld As String
Sub ExcelProgress()
For i = 0 To i = "stop"
text1 = ex.Range("i").Value
strNameOld = i
Next i
End Sub
'Fonction qui permet de renommer les fichiers CATIA pour compléter leurs noms
'Prends en paramètre une chaîne.
Public Function renameFile(strNameOld As String) As String
Dim strCharTemp As String
'Si le fichier ne contient pas de caractère à la position 10 c'est un arbre plan CATProduct
If Mid(strCharTemp, 10, 1) = "" Then
strCharTemp = Left(strCharTemp, 9) + ".CATProduct"
End If
'Si le fichier contient 0 en position 10 et rien en position 15 c'est un CATProduct
If Mid(strCharTemp, 10, 1) = "0" And Mid(styrCharTemp, 15, 1) = "" Then
strCharTemp = Left(strCharTemp, 14) + ".CATProduct"
End If
'Si le fichier contient "-STD01" on obtient un CATPart
If Mid(strCharTemp, 15, 6) = "-STD01" Then
strCharTemp = Left(strCharTemp, 20) + ".CATPart"
End If
'Si le fichier contient 2 en position 10 c'est un CATPart
If Mid(strCharTemp, 10, 1) = "2" Then
strCharTemp = Left(strCharTemp, 14) + ".CATPart"
End If
'Si le fichier contient "-" en position 10 on obtient un CATDrawing
If Mid(strCharTemp, 10, 1) = "-" Then
strCharTemp = Left(strCharTemp, 12) + ".CATDrawing"
End If
'nettoyage du fichier Excel : Suppression du mot "stop" pour l'export en .csv
'ce mot permet d'arrêter la fonction qui doit tourner dans la colonne A et B.
If strNameOld = "stop" Then
strNameOld = Null
End If
renameFile = strCharTemp
End Function |
Partager