Arkadaşlar merhaba,
Bu kodu tek başına kullandığım zaman userform'u siliyor fakat aşağıdaki kod ile birlikte kullandığım zaman sadece buçalışmakitabı içindeki kodu siliyor, userform kalıyor. Neden olabilir?
Kod:
ThisWorkbook.VBProject.VBComponents.Remove VBComponent:=ThisWorkbook.VBProject.VBComponents.Item("UserForm1")
Kod:
Private Sub CommandButton8_Click()
ThisWorkbook.VBProject.VBComponents.Remove VBComponent:=ThisWorkbook.VBProject.VBComponents.Item("UserForm1")
For Each MyMod In ThisWorkbook.VBProject.VBComponents
Set MyMod = ThisWorkbook.VBProject.VBComponents(MyMod.Name)
If MyMod.Type = 100 Then
Set VBCodeMod = MyMod.CodeModule
MyMod.CodeModule.DeleteLines 1, VBCodeMod.CountOfLines
Else
ThisWorkbook.VBProject.VBComponents.Remove MyMod
End If
Next
End Sub