Sub CATMain()
Dim Eingabe As String
	Eingabe = "D:\pf"
	Eingabe = InputBox ("Bitte geben Sie den Öffnungs Ort  ein.", "Alle Parts/Products Öffnen", Eingabe)

    Dim oFileSystem As INFITF.FileSystem
    Set oFileSystem = CATIA.FileSystem
    Dim oFolder As INFITF.Folder
    ' Verzeichnisname für CATIA-Part
    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
																											    'Dim BackView As DrawingView
																											    'Dim oText As DrawingText
    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

    Next
End Sub
