Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim uidoc As notesuidocument
Set uidoc =workspace.currentdocument
Dim doc As NotesDocument
Set doc = uidoc.document
Dim ACL As NotesACL
Set ACL = db.ACL
Dim ACLEntry As NotesACLEntry
For x = 0 To Ubound(doc.groupstoadd)
Set ACLEntry = ACL.CreateACLEntry ( doc.groupstoadd(x), ACLLEVEL_EDITOR )
ACLEntry.CanDeleteDocuments = True
ACLEntry.IsGroup = True
ACLEntry.UserType = 4
Call ACLEntry.EnableRole( doc.Roles(x) )
Call ACL.Save
Next
Print x & " group created"
End Sub