Makrowarnung obwohl Makros gelöscht wurden
scheichuwe
das Problem wurde schonmal besprochen, allerdings gibt's bisher keine Lösung:
https://www.herber.de/forum/archiv/264to268/t264556.htm
Eine Datei wird automatisch und ohne Makros (diese werden gelöscht) an einem bestimmten Ort gespeichert.
Beim öffnen der gespeicherten Datei kommt eine Makrowarnung, obwohl keine Makros (auch keine Module, Userforms etc.) mehr vorhanden sind. Wenn ich die Datei nochmal speicher und wieder öffne gibt's die Warnung nicht mehr. Hier noch mein Code, zusammengebastelt hier aus dem Forum (Danke dafür:-)!)
Private Sub CommandButton2_Click()
dateiname = "Ruf_" & Cells(169, 4).Text & "-" & Cells(169, 7).Text
Set WB = ActiveWorkbook
Call Lösche_Module
Call Lösche_Userformen
Call Lösche_Ereignisprozeduren
CommandButton1.Select
Selection.Delete
CommandButton2.Select
Selection.Delete
WB.SaveAs Filename:="D:\Schwertfechter\TEMP\" & dateiname & ".xls"
WB.Close savechanges:=False
End Sub
Sub Lösche_Module()'Löscht Module:
For n = ThisWorkbook.VBProject.vbComponents.Count To 1 Step -1
If ThisWorkbook.VBProject.vbComponents(n).Type = 1 Then
ThisWorkbook.VBProject.vbComponents(n).Collection.Remove ThisWorkbook.VBProject.vbComponents(n)
End If
Next
End Sub
Sub Lösche_Userformen()
'Löscht Userforms:
For n = ThisWorkbook.VBProject.vbComponents.Count To 1 Step -1
If ThisWorkbook.VBProject.vbComponents(n).Type = 3 Then
ThisWorkbook.VBProject.vbComponents(n).Collection.Remove ThisWorkbook.VBProject.vbComponents(n)
End If
Next
End Sub Sub Lösche_Ereignisprozeduren()
'Löscht Ereignisprozeduren:
For n = ThisWorkbook.VBProject.vbComponents.Count To 1 Step -1
For i = 1 To ThisWorkbook.VBProject.vbComponents(n).CodeModule.CountOfLines
If ThisWorkbook.VBProject.vbComponents(n).Type 1 And ThisWorkbook.VBProject.vbComponents(n).Type 3 Then _
ThisWorkbook.VBProject.vbComponents(n).CodeModule.DeleteLines 1
Next
Next
End Sub
Danke für eure Hilfe.
Uwe