• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

User Form' a makro ile buton ekleme

Sn halit teşekkürler,

Kod:
 ' ' ThisWorkbook.VBProject.VBComponents.Remove VBComponent:=form
bu satırı kaldırdım,

yalnız formu kapatıp açınca CommandButton lar form üzerinde olmasına karşın, msgbox komutu tekrar çalışmıyor.


Kod:
Sub CommandButton1_Click()
Dim Kontrol As Control
For Each Kontrol In UserForm1.Controls
If TypeName(Kontrol) = "CommandButton" Then
say2 = say2 + 1
ReDim Preserve CommandButton(1 To say2)
Set CommandButton(say2).CommandButtonGrup = Kontrol
End If
Next
UserForm1.Show
End Sub
 
Üsdeki mesajdaki kodda eksiklik vardı güncelledim.
 
Teşekkürler Halit
 
Hocam userform açık iken dinamik togglebutton'laroluşturuyorum içlerine kod eklemek istediğim zaman userform kapanıyor. Sanırım runtime esnasında olmuyor. bu sorunu userform açık iken basitçe çözebileceğim bir yol var mı?

For Each kontrol In UserForm1.MultiPage2.Pages(0).Controls
If TypeName(kontrol) = "ToggleButton" Then
With ThisWorkbook.VBProject.VBComponents.Item("Userform1").CodeModule
i = .CountOfLines
.InsertLines i + 1, "private sub " & kontrol.Name & "_Click"
.InsertLines i + 2, "msgbox ""selam"""
.InsertLines i + 3, "end sub"
End With
j = j + 1
End If
Next kontrol
 
Geri
Üst