Im unteren Makro wird eine neue Datei gespeichert.
Nur habe ich ein Problem: In der neuen Datei sollte die Shapes("Neu") gelöscht werden.
Ich bekomme aber immer eine Fehlermeldung.
Könnte mir bitte jemand helfen,wie das Shapes.delete richtig gesetzt wird ?
Danke Heinz
Option Explicit
Sub Speichern()
Dim strAktuellerPfad As String
Dim fileSaveName As String, strfileSaveName As String
Dim MyPfad As String
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs strAktuellerPfad & ThisWorkbook.Sheets("Sortierrapport").Range("A1"). _
Value & " " _
& Range("Sortierrapport!C1") & " " & Range("Sortierrapport!R2") & " " & "-" & " " & _
Range("Sortierrapport!S2") & ".xls"
strAktuellerPfad = ActiveWorkbook.Path
MyPfad = IIf(Right$(ThisWorkbook.Path, 1) = Application.PathSeparator, ThisWorkbook.Path, _
ThisWorkbook.Path & Application.PathSeparator)
ActiveSheet.Shapes("Neu").Delete
With ActiveWorkbook.VBProject
.VBComponents.Remove .VBComponents("UserFormDaten")
.VBComponents.Remove .VBComponents("Speichern_unter")
.VBComponents.Remove .VBComponents("UserForm1_Anzeigen")
End With
Application.DisplayAlerts = True
End Sub