Zurück zur Homepage

Modeless-Form

Im Beispiel Modeless Userform in XL97 steckt auch Code, um gleichzeitig mit der Form und dem Tabellenblatt zu arbeiten.

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