Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "user32" _
(ByVal hwnd As Long, ByVal bEnable As Long) As Long
Private Sub UserForm_Activate()
Dim hwndXL&
hwndXL = FindWindow("XLMAIN", Application.Caption)
If hwndXL <> 0 Then
EnableWindow hwndXL, 1
Application.CellDragAndDrop = False
End If
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.CellDragAndDrop = True
End Sub