Hallo zusammen, ich probiere jetzt schon seit längerem herum, komme aber nicht auf die Lösung für mein Problem.
Und zwar wird mir in der unten gekennzeichneten Zeile der Fehler "Compile Error: Object required" angezeigt.
Code:Public Sub Stücklistenteil_konfigurieren() Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument If oDoc.DocumentType <> kAssemblyDocumentObject Or oDocType <> kPartDocumentObject Or oDocType <> kDrawingDocumentObject Then If Not oDoc.SelectSet.Count = 1 Then MsgBox ("Bitte wähle eine Komponente aus!") Do While Not oDoc.SelectSet.Count = 1 DoEvents Loop End If If Not oDoc.SelectSet.Count = 1 Then MsgBox ("In dieser Ansicht sind mehrere Komponenten enthalten! Geh in die Baugruppe und wähle dort die entsprechende Komponente aus!") Stop Else If oDoc.SelectSet.Item(1).ReferencedDocumentDescriptor.ReferencedDocumentType = kPartDocumentObject Then Dim oPart As Object Set oPart = oDoc.SelectSet.Item(1).ReferencedDocumentDescriptor.ReferencedDocument Dim oSelectSet As SelectSet Set oSelectSet = oDoc.SelectSet Dim oSelectedItem As Variant Set oSelectedItem = oSelectSet.Item(1) Dim oDocumentDescriptor As DocumentDescriptor Set oDocumentDescriptor = oSelectedItem.ReferencedDocumentDescriptor Dim oReferencedDocument As Object Set oReferencedDocument = oDocumentDescriptor.ReferencedDocument Dim oDisplayName As String Set oDisplayName = oReferencedDocument.DisplayName <-- Hier bei oDisplayName tritt der Fehler auf frm_Baut_Konf.Show frm_Baut_Konf.txt_BautNr.Text = oDisplayName
Else: MsgBox ("In der Ansicht ist kein Bauteil enthalen!") Stop End If End If Else MsgBox ("Die Funktion ist entweder in einer Zeichnung, Baugruppe oder einem Bauteil verfügbar!") Stop End If End Sub