über eine Userform kopiere ich aus einer Arbeitsmappe 2 Tabellen.
In die neue Mappe möchte ich ein Modul kopieren.
Leider klappt dann das speichern nicht.
Wenn ich die Mappe unter "xlsx" speicher ist das Modul1 weg, wenn
ich es mit "xlsm" versuche kommt die Meldung, das die Dateiendung nicht stimmt.
Sub AufmaßundZusmitModulkopieren()
Pfad = ThisWorkbook.Path & "\Modul1.bas"
Art = Workbooks("Start.xlsm").Sheets("H_Tab").Cells(9, 2).Value 'gibt an aus welcher Mappe aus _
welcher Mappe kopiert werden soll
Windows(Art).Activate
Sheets(Array("Zusammenfassung", "Aufmaß")).Select
Sheets(Array("Zusammenfassung", "Aufmaß")).Copy
Application.DisplayAlerts = False
ActiveWorkbook.Application.VBE.ActiveVBProject.VBComponents.Import Pfad
sPath = ThisWorkbook.Path & "\" & "Aufmaße" & "\" & "Bauherrenaufmaß" & "\"
sFile = UserForm5.TextBox1.Value & " " & UserForm5.TextBox2.Value & " " & UserForm5.TextBox3. _
Value & ".xlsm"
If sFile = "" Then Exit Sub
ActiveWorkbook.SaveAs sPath & sFile ' hier kommt die Fehlermeldung
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.CutCopyMode = False
End Sub
Danke für Eure Hilfe!Gruß