Ragulduy, thanks so much for your swift reply. No, there is no visual effect at all, just a dead keyboard.
I do get a pulsing egg timer for ever, if I try to close Excel. at this stage I have to use Task Manager to kill it off.
The app in development is structured as follows ...
All the code is in an xla, part of a suite of xlas that produce different output workbooks. In each case the output workbook is passive, that is it contains no code.
In turn the xlas have the benefit of an master xla that provides library functions and also watches over Excel, trapping book and sheet events, recognising if they are generated by one of the passive workbooks, and then requesting code to run in the appropriate xla. So I can't really upload a working example without uploading the whole lot.
I started noticing this effect after putting in some mouse event handlers on the Form, the purpose of which is to re-order sections of a worksheet by dragging and dropping items in a ListBox.
Here is the code for the mouse_up event which appears to be the culprit, code below. I'm really only asking if anyone has ever seen this, because in 10 years I have never done so.
Private Sub lstDocumentTitles_MouseUp(ByVal Button As Integer, ByVal shift As Integer, ByVal x As Single, ByVal Y As Single)
Dim section As SynopsisSection, xlSource As Excel.Range, xlTarget As Excel.Range
Dim OK As Boolean
' this ListBox event handler moves a section of a worksheet, that corresponds to an item on the list, by dragging and dropping
' also re-orders the listbox to reflect changes on the sheet
' this determins the list index where the drop occured
dragDrop = lstDocumentTitles.ListIndex
' dragstart has previously been set by the "lstDocumentTitles_MouseDown" event handler
'checks that both dragdrop and dragstart hold valid indecees
OK = Not (dragDrop < 0 Or dragStart < 0)
'checks that they are not the same (no movement needed)
OK = OK And dragDrop <> dragStart
If OK Then
With frmHands.Document.synopsis
' gets the section that dragstart refers to
' the "section" is a user defined type which includes a range object
'ListBox indecees are 0 based, the section array is 1 based, hense the "+1"
If .GetSection(dragStart + 1, section) Then
'set xlsource to the range contained in the source section
Set xlSource = section.xlRange.EntireRow
If Not xlSource Is Nothing Then
' gets the section that dragdrop refers to
If .GetSection(dragDrop + 1, section) Then
'set xlTarget to the range contained in the target section
Set xlTarget = section.xlRange.Rows(1).EntireRow
' do the sheet stuff
If Not xlTarget Is Nothing Then
With Application
.enableEvents = False
xlSource.Cut
xlTarget.Insert
.CutCopyMode = False
.enableEvents = True
End With
'reload the form so it reflects the changes on the sheet by re-running the Activate event
'which re-reads the document into the ListBoxes
UserForm_Activate
' re-selects the list item in question
lstDocumentTitles.ListIndex = dragDrop
End If
End If
End If
End If
End With
End If
'tidy
'drapdrop was set to zero or above by this event handler
dragDrop = -1
'dragging was set to true by the "lstDocumentTitles_MouseDown" event handler
dragging = False
'moving was set to true by the "lstDocumentTitles_MouseMove" event handler
Moving = False
End Sub
Bookmarks