Over on Chip Pearson’s download page, there’s a file called EventSeq.xls. It has a message box in every event so you can see what events get fired when and in what order. I use it at least a couple of time per year, sometimes to see the order events, but more often to see which event fires when I do something.
Someone sent me an email asking which event fires when you add a shape to a worksheet. EventSeq.xls to the rescue. The answer is: no event fires. As I was using that file, I got tired of clearing all those darn message boxes, so I tweaked things a little. Instead of message boxes, I log the events in a listbox. Since Chip did all the work, all I had to do was make a procedure to fill the listbox, then do a find and replace.
One problem I encountered using this method is logging the events that happen when you close the workbook. They all get logged, but the userform disappears so fast, you can’t see them. I ended up writing everything in the listbox to a CSV file when the file closes.
As long as I was in there, I added code for all the events through 2003.
Lastly, I added an Annotate button. This allowed me to stick a note in the listbox to deliniate when I did something. See the screen shots below.
Download EventSeq.zip and let me know what you think.
Here’s some code:
Dim vMsg As Variant
Dim i As Long
vMsg = Split(sMsg, vbTab)
For i = 1 To UBound(vMsg)
.List(.ListCount – 1, i) = vMsg(i)
.TopIndex = ULog.lbxAppLog.ListCount – 1
Dim i As Long, j As Long
Dim sFname As String
Dim sPath As String
Dim lFnum As Long
Dim sLine As String
sPath = ThisWorkbook.Path
sFname = “EventSeqLog.csv”
lFnum = FreeFile
Open sPath & “” & sFname For Output As lFnum
For i = 0 To .ListCount – 1
For j = 0 To .ColumnCount – 1
sLine = sLine & .List(i, j) & “,”
Print #lFnum, sLine
sLine = “”
Here’s Here are some screen shots: