1 | initial version |
To modify the parent window of a UserForm using VBA, the following steps can be followed:
Dim uf As UserForm
Set uf = UserForm1
uf.ShowModal = False
Dim hwndParent As Long
hwndParent = uf.hwnd
Dim hwndNewParent As Long
hwndNewParent = FindWindow("Notepad", vbNullString)
SetParent hwndParent, hwndNewParent
In this example, the parent window of the UserForm will be set to the Notepad window.