Kann mir jemand weiterhelfen? Mit dem untenstehenden Code füge ich soviele Checkboxen in eine Userform ein wie ausgefüllte Zeilen vorhanden sind.
Nun möchte ich bei aktivierter Checkbox dass die Werte dahinter (Spalte A, B, C und H) in ein Worddokument (*.dot) eingefügt werden. Für jede aktivierte Checkbox sollte nun ein neues Worddokument eröffnet werden.
Option Explicit
Private Sub UserForm_Initialize()
Dim ctrCheck As Control
Dim i As Long
Dim it As Integer
it = 15
For i = 1 To 30
If Cells(i, 1) <> "" Then
Set ctrCheck = Me.Controls.Add("Forms.CheckBox.1")
ctrCheck.Top = 5 + (i - 1) * it
ctrCheck.Left = 5
ctrCheck.Width = 400
ctrCheck.Caption = Cells(i, 1) & " " & Cells(i, 2)
Set ctrCheck = Me.Controls.Add("Forms.Label.1")
ctrCheck.Top = 9 + (i - 1) * it
ctrCheck.Left = 150
ctrCheck.Width = 400
ctrCheck.Caption = "Mitgliederstatus: " & Cells(i, 5)
Set ctrCheck = Nothing
End If
Next
End Sub
Vielen Dank