AW: Objekt erforderlich
15.12.2020 11:26:04
Jonathan
Hab jetzt den Code entsprechend angepasst, aber leider ohne erfolg. Es kommt immer noch die Fehlermeldung Objekt erforderlich
Hyperlinks.Add Anchor:=Range("A" & last), _
Address:=ActiveWorkbook.Path & "\" & Bereich & "\" & lastID, _
TextToDisplay:=lastID
Ich bin relativ sicher, dass alle Variablen definiert sind. Wenn ich beim Fehler in den Debugmodus gehe, und ich über die Variablen LastID, Beriech, Last fahre erscheinen immer die richtigen Werte. Da ich dachte dass es nicht notwendig ist, das ganze sub, (dort sind auch nicht alle Variablen deklariert) zu posten habe ich nur den Teil wo ich den Fehler vermute gepostet. Hier trotzdem nochmal das ganze Sub:
Private Sub CommandButton_Dateneingabe_Click()
'erste freie Zeile ausfindig machen
last = Cells(Rows.Count, 1).End(xlUp).Row + 1
lastID = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
If TextBox_Datum = "" Or TextBox_FAF = "" Or TextBox_FAF_Artikelnummer = "" Or ComboBox_AS = "" _
Or ComboBox_Fehler = "" Or TextBox_Fehlerbeschreibung = "" Then
MsgBox "Bitte zuerst alle Pflichtfelder ausfüllen"
Else
If InStr(ComboBox_Fehler.Value, " - ") > 0 Then
MsgBox "Bitte bei Fehlerbeschreibungscode einen Fehlerunterpunkt wählen."
Exit Sub
Else
If Len(TextBox_FAF) 9 Then
MsgBox "Bitte richtige FAF-Nr. (FAFXXXXXX) eingeben"
Exit Sub
End If
End If
End If
If Dir$(ActiveWorkbook.Path & "\" & Bereich & "\" & lastID, vbDirectory) "" Then
Else
MkDir ActiveWorkbook.Path & "\" & Bereich & "\" & lastID
End If
Call screenshot
If strFileName = "" Then
Else
Anhang
End If
ActiveWorkbook.Unprotect
'Cells(last, 1).Value = lastID
'With Workbook.ActiveSheet.Name
Hyperlinks.Add Anchor:=Range("A" & last), _
Address:=ActiveWorkbook.Path & "\" & Bereich & "\" & lastID, _
TextToDisplay:=lastID
'End With
'Datum
Cells(last, 2).Value = TextBox_Datum
'Ersteller
Cells(last, 3).Value = UserForm_User.ComboBox_Ersteller
'RMA
Cells(last, 4).Value = TextBox_RMA
'FAF -Nr
Cells(last, 5).Value = TextBox_FAF
'Artikel vom FAF
Cells(last, 6).Value = TextBox_
'SN
'Cells(last, 6).Value = TextBox_SN
'Arbeitsschritt
Cells(last, 9).Value = ComboBox_AS
'Fehlerkategorie
Cells(last, 10).Value = ComboBox_Fehler
'Kurzbeschreibung
Cells(last, 11).Value = TextBox_Fehlerbeschreibung
MsgBox "Daten sind in Tabelle eingetragen"
ActiveWorkbook.Save
End Sub