Option Explicit Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As LongPrivate lHwnd As Long Private Sub Form_Load() On Error GoTo ErrTrap Dim acadApp As Object Set acadApp = CreateObject("AutoCAD.Application") acadApp.Visible = True lHwnd = GetParent(GetParent(acadApp.Activedocument.hwnd)) If lHwnd = 0 Then Exit Sub SetParent lHwnd, Form1.hwnd Exit Sub ErrTrap: On Error GoTo 0End Sub Private Sub Form_Unload(Cancel As Integer) If lHwnd = 0 Then Exit Sub SetParent lHwnd, 0End Sub