VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Audi_Teilenummer_aendern 
   Caption         =   "Bauteilbenennung ändern"
   ClientHeight    =   3720
   ClientLeft      =   48
   ClientTop       =   432
   ClientWidth     =   13080
   OleObjectBlob   =   "Audi_Teilenummer_aendern.frx":0000
   StartUpPosition =   1  'CenterOwner
End
Attribute VB_Name = "Audi_Teilenummer_aendern"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Makro:        Audi_Teilenummer_aendern
' Version:      1.0
' Catia Level:  V5R19
' UIL:          English (User Interface Language)
' Autor:        Christian Obholzer
' E-Mail:       ch.obholzer@aon.at
' Erstellt:     19.06.2010
' Zweck:        Es wird die Eingabe der neuen Audi-Teilenummer erleichtert
'-----------------------------------------------------------------------------------
' Änderungen:   Datum, Name
'               Hier wird die Änderung angegeben
'               Datum, Name
'               Hier wird die Änderung angegeben
'-----------------------------------------------------------------------------------

    Dim Dokument As Windows
    Dim Doc As Document
    Dim strTyp As String
    Dim Box As VbMsgBoxResult
    Dim objDatei As Product
    Dim strDateiname As String
    Dim strFeld1 As String * 11
    Dim strFeld2 As String * 2
    Dim strFeld3 As String * 3
    Dim strFeld4 As String * 3
    Dim strFeld5 As String * 3
    Dim strFeld6 As String * 3
    Dim strFeld7 As String * 18
    Dim strFeld8 As String * 20
    
Option Explicit
    
Private Sub cmb_Beenden_Click()

    Unload Me
    
End Sub

Private Sub cmb_Eintragen_Click()
    
    strFeld1 = Me.txt_Box_9.Value
    strFeld1 = Replace(strFeld1, " ", "_")
    
    strFeld2 = Me.txt_Box_10.Value
    strFeld2 = Replace(strFeld2, " ", "_")
    
    strFeld3 = Me.txt_Box_11.Value
    strFeld3 = Replace(strFeld3, " ", "_")
    
    strFeld4 = Me.txt_Box_12.Value
    strFeld4 = Replace(strFeld4, " ", "_")
    
    strFeld5 = Me.txt_Box_13.Value
    strFeld5 = Replace(strFeld5, " ", "_")
    
    strFeld6 = Me.txt_Box_14.Value
    strFeld6 = Replace(strFeld6, " ", "_")

    strFeld7 = Me.txt_Box_15.Value
    strFeld7 = Replace(strFeld7, " ", "_")
    
    strFeld8 = Me.txt_Box_16.Value
    strFeld8 = Replace(strFeld8, " ", "_")
    
    strDateiname = strFeld1 + "_" + strFeld2 + "_" + strFeld3 + "_" + strFeld4 + "_" + strFeld5 + "_" + strFeld6 + "_" + strFeld7 + "_" + strFeld8
    Set objDatei = CATIA.ActiveDocument.Product
    objDatei.PartNumber = UCase(strDateiname)
    
    Unload Me

End Sub

Private Sub opt_Dateiname_Click()
    
    Me.txt_Box_1.Value = Left(CATIA.ActiveDocument.Name, 11)
    Me.txt_Box_2.Value = Mid(CATIA.ActiveDocument.Name, 13, 2)
    Me.txt_Box_3.Value = Mid(CATIA.ActiveDocument.Name, 16, 3)
    Me.txt_Box_4.Value = Mid(CATIA.ActiveDocument.Name, 20, 3)
    Me.txt_Box_5.Value = Mid(CATIA.ActiveDocument.Name, 24, 3)
    Me.txt_Box_6.Value = Mid(CATIA.ActiveDocument.Name, 28, 3)
    Me.txt_Box_7.Value = Mid(CATIA.ActiveDocument.Name, 32, 18)
    Me.txt_Box_8.Value = Mid(CATIA.ActiveDocument.Name, 51, 20)
    
    Me.txt_Box_9.Value = Left(CATIA.ActiveDocument.Name, 11)
    Me.txt_Box_10.Value = Mid(CATIA.ActiveDocument.Name, 13, 2)
    Me.txt_Box_11.Value = Mid(CATIA.ActiveDocument.Name, 16, 3)
    Me.txt_Box_12.Value = Mid(CATIA.ActiveDocument.Name, 20, 3)
    Me.txt_Box_13.Value = Mid(CATIA.ActiveDocument.Name, 24, 3)
    Me.txt_Box_14.Value = Mid(CATIA.ActiveDocument.Name, 28, 3)
    Me.txt_Box_15.Value = Mid(CATIA.ActiveDocument.Name, 32, 18)
    Me.txt_Box_16.Value = Mid(CATIA.ActiveDocument.Name, 51, 20)

End Sub

Private Sub opt_PartNumber_Click()

    Set objDatei = CATIA.ActiveDocument.Product
    strDateiname = objDatei.PartNumber
    
    Me.txt_Box_1.Value = Left(strDateiname, 11)
    Me.txt_Box_2.Value = Mid(strDateiname, 13, 2)
    Me.txt_Box_3.Value = Mid(strDateiname, 16, 3)
    Me.txt_Box_4.Value = Mid(strDateiname, 20, 3)
    Me.txt_Box_5.Value = Mid(strDateiname, 24, 3)
    Me.txt_Box_6.Value = Mid(strDateiname, 28, 3)
    Me.txt_Box_7.Value = Mid(strDateiname, 32, 18)
    Me.txt_Box_8.Value = Mid(strDateiname, 51, 20)
    
    Me.txt_Box_9.Value = Left(strDateiname, 11)
    Me.txt_Box_10.Value = Mid(strDateiname, 13, 2)
    Me.txt_Box_11.Value = Mid(strDateiname, 16, 3)
    Me.txt_Box_12.Value = Mid(strDateiname, 20, 3)
    Me.txt_Box_13.Value = Mid(strDateiname, 24, 3)
    Me.txt_Box_14.Value = Mid(strDateiname, 28, 3)
    Me.txt_Box_15.Value = Mid(strDateiname, 32, 18)
    Me.txt_Box_16.Value = Mid(strDateiname, 51, 20)

End Sub

Private Sub UserForm_Initialize()

    Set Dokument = CATIA.Windows
    If Dokument.Count = 0 Then
        Box = MsgBox("Es ist kein Dokument geöffnet." + vbNewLine + _
        "Das Makro kann nicht ausgeführt werden." + vbNewLine + _
        "Klicken Sie im nächsten Fenster auf den Button Beenden.", vbCritical + vbOKOnly, "Kein Dokument offen")
        cmb_Eintragen.Enabled = False
        opt_Dateiname.Enabled = False
        opt_PartNumber.Enabled = False
        Exit Sub
    End If

    Set Doc = CATIA.ActiveDocument
    strTyp = TypeName(Doc)
    If strTyp = "DrawingDocument" Then
        Box = MsgBox("Dieses Dokument ist ein Drawing." + vbNewLine + _
        "Das Makro kann nicht ausgeführt werden." + vbNewLine + _
        "Klicken Sie im nächsten Fenster auf den Button Beenden.", vbCritical + vbOKOnly, "Falscher Dokumententyp")
        cmb_Eintragen.Enabled = False
        opt_Dateiname.Enabled = False
        opt_PartNumber.Enabled = False
        Exit Sub
    End If
    
    Me.txt_Box_1.Value = Left(CATIA.ActiveDocument.Name, 11)
    Me.txt_Box_2.Value = Mid(CATIA.ActiveDocument.Name, 13, 2)
    Me.txt_Box_3.Value = Mid(CATIA.ActiveDocument.Name, 16, 3)
    Me.txt_Box_4.Value = Mid(CATIA.ActiveDocument.Name, 20, 3)
    Me.txt_Box_5.Value = Mid(CATIA.ActiveDocument.Name, 24, 3)
    Me.txt_Box_6.Value = Mid(CATIA.ActiveDocument.Name, 28, 3)
    Me.txt_Box_7.Value = Mid(CATIA.ActiveDocument.Name, 32, 18)
    Me.txt_Box_8.Value = Mid(CATIA.ActiveDocument.Name, 51, 20)

    Me.txt_Box_9.Value = Left(CATIA.ActiveDocument.Name, 11)
    Me.txt_Box_10.Value = Mid(CATIA.ActiveDocument.Name, 13, 2)
    Me.txt_Box_11.Value = Mid(CATIA.ActiveDocument.Name, 16, 3)
    Me.txt_Box_12.Value = Mid(CATIA.ActiveDocument.Name, 20, 3)
    Me.txt_Box_13.Value = Mid(CATIA.ActiveDocument.Name, 24, 3)
    Me.txt_Box_14.Value = Mid(CATIA.ActiveDocument.Name, 28, 3)
    Me.txt_Box_15.Value = Mid(CATIA.ActiveDocument.Name, 32, 18)
    Me.txt_Box_16.Value = Mid(CATIA.ActiveDocument.Name, 51, 20)

    Me.opt_Dateiname.Value = True
    Me.opt_PartNumber.Value = False
    
End Sub

