You can try:
'Pass the form object (you could also use string as the
'parameter and replace the if condition to: "If form.Name.Equals(targetForm) Then")
Public Sub BringToFront(ByVal targetForm As Form)
Dim form As Form
For Each form In Application.OpenForms()
If form Is targetForm Then
form.BringToFront()
Exit For
End If
Next
End Sub
Call this subsection if you need to bring a specific shape in front (only if it is already loaded) as follows:
BringToFront(targetformobject)
source
share