The strange case of error “Subscript out of range” in Data View starting VB 6

I am writing this little post mainly for myself in the future and the other two users that seem to have experienced this in the past. I already saw this in the past but until today I didn’t find out how to fix it:

If you get a msgbox error with the title “Data View” and the text “Subscript out of range” starting Visual Basic 6.0, it means that your commandbars are corrupted and need resetting:

– Right-click on any toolbar and select “Customize…” menu entry.

– For each toolbar in the list, click the “Reset…” button.

How did I find this fix? After using SysInternals Process Monitor for a while, I only discovered that Data View is actually a kind of hidden add-in. It doesn’t appear in the Add-In Manager, but it has a Connect class, a toolwindow, etc. The clue was that right-clicking on the treeview of its toolwindow, another error “91 : object variable or with block variable not set” happened and the toolwindow was crashed. And what happens typically when you right-click a treeview node? A commandbar is shown! If the commandbar is not shown, it means that there is a problem with the commandbar subsystem (quite typical of VB6), so I tried resetting the commandbars as explained above and bingo!