Super Danke bgrittmann,
Der Link war sehr Hilfreich, habe am Wochenende am Code herumgebastelt
sieht glaub ich nicht mehr so schlecht aus.
Dennoch bekomme ich eine Fehlermeldung "Compile error: Variable not defined".
Weiters hab ich unter Tools-> References
Alle Files ausgewählt die mit CATIA anfangen.
fkt leider doch nicht, er bleibt immer bei "pro" stehen.
Code:
'Teilenummer mit Filename abgleichen
Private Sub CommandButton1_Click()
Dim Eingabe As String
Eingabe = InputBox("Bitte geben Sie den Speicher Ort ein.", "Alle Parts/Products Speichern", Eingabe)
Dim oFileSystem As INFITF.FileSystem
Set oFileSystem = CATIA.FileSystem
Dim oFolder As INFITF.Folder
Set oFolder = oFileSystem.GetFolder(Eingabe)
Dim FileSep As String
FileSep = oFileSystem.FileSeparator
Dim i As Long
Dim j As Variant
Dim oFile As INFITF.File
Dim oActiveDoc As DrawingDocument
For i = 1 To oFolder.Files.Count
Set oFile = oFolder.Files.Item(i)
If Right(oFile.Name, 7) = "CATPart" Then
Set oActiveDoc = CATIA.Documents.Open(oFolder.Path + FileSep + oFile.Name)
Dim document As document
Dim splitname As String
Set document = CATIA.ActiveDocument
splitname = Split(document.Name, ".")
Set pro = document.Product
pro.PartNumber = splitname(0)
oActiveDoc.Save
oActiveDoc.Close
End If
'For i = 1 To oFolder.Files.Count
Set oFile = oFolder.Files.Item(i)
If Right(oFile.Name, 10) = "CATProduct" Then
Set oActiveDoc = CATIA.Documents.Open(oFolder.Path + FileSep + oFile.Name)
'Dim document As document
'Dim splitname As string
Set document = CATIA.ActiveDocument
splitname = Split(document.Name, ".")
Set pro = document.Product
pro.PartNumber = splitname(0)
oActiveDoc.Save
oActiveDoc.Close
End If
End Sub
------------------
Mit freundlichen Grüßen
Catiawest
NIHIL IMPOSSIBILE =)
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP