AW: Dynamische CheckBoxen mit Code erzeugen
14.11.2015 18:13:15
Tino
Hallo,
könnte in etwa so funktionieren.
Sub CheckBox_Add()
Dim rng As Range, oShape As Object
With Tabelle1
Set rng = .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
If rng.Rows(1).Row < 2 Then Exit Sub
For Each rng In rng.Cells
With .Cells(rng.Row, 5)
Set oShape = .Parent.CheckBoxes.Add(.Left, .Top, .Width, .Height)
End With
oShape.Caption = "Mail-Senden"
oShape.OnAction = "E_Mail_erzeugen"
Next rng
End With
End Sub
Sub E_Mail_erzeugen()
Dim rng As Range, MyOutApp As Object, MyMessage As Object
Set rng = ActiveSheet.Shapes(Application.Caller).TopLeftCell.EntireRow
Set MyOutApp = CreateObject("Outlook.Application")
Set MyMessage = MyOutApp.CreateItem(0)
With MyMessage
.To = rng.Cells(1, 1)
.Subject = rng.Cells(1, 2)
.body = rng.Cells(1, 3)
.Display
End With
End Sub
Gruß Tino