Put this code in a module, it will create your box for you
Code:
Function DrawBox()
Dim ctl As Control
Dim bLeft As Integer
Dim bTop As Integer
Dim bHeight As Integer
Dim bWidth As Integer
Const Margin = 60
With Screen.ActiveForm
bLeft = .Width
bTop = .Section(acDetail).Height
bHeight = 0
bWidth = 0
For Each ctl In .Controls
If ctl.InSelection Then
If ctl.Left < bLeft Then bLeft = ctl.Left
If ctl.Top < bTop Then bTop = ctl.Top
If ctl.Left + ctl.Width > bWidth Then bWidth = ctl.Left + ctl.Width
If ctl.Top + ctl.Height > bHeight Then bHeight = ctl.Top + ctl.Height
End If
Next ctl
Set ctl = Application.CreateControl(.Name, acRectangle, acDetail, , , bLeft - Margin, bTop - Margin, bWidth - bLeft + Margin * 2, bHeight - bTop + Margin * 2)
with ctl
'set any properties you want here
end with
End With
End Function
Then add an autokey macro to run it (perhaps ctrl+B? so macro is called ^B)
in your form design view, highlight the controls you want a box round and hit ctrl-B
Note the above has no error handling and assumes the controls are in the detail section - at least that is where the box control will be created, feel free to modify as you require. The name is autocreated in the same way when you create a a control