BobBridges
Active Member
I've just encountered something strange in Excel VBA. I gotta think it's related to the latest update, but I've been wrong so many times before.
Usually in the VBE I can mouse over a variable to see its value, for example I might see this popup:
This error, however, causes the popup to drop the last word and the final quote, like this:
If there's only one word in the string—for instance if va contains only "AJONES"—the mouseover shows this:
Again notice the missing quotes. Has anyone else spotted this?
The trigger, after much experimentation, seems to be, simply, the appearance of the letters "AJ" anywhere in the string. They must be upper case, and they must be adjacent, and they must be in that order.
It gets weirder: 1) I wondered whether one of the spaces might really be a CR or LF, but I typed the string manually into the program and it still errs. 2) The string is displayed properly in the Immediate window; when I ask "?va" I see nothing wrong there. 2) Len(va) correctly tells me the length of the string, both in the code and the Immediate window.
But wait, there's more! I split the string; in the Immediate window all the values in the array display correctly, but a mouseover of each element in the code window shows the same error for the particular word that contains "AJ"; the other words show correctly. I assign each element of the array to a collection; the whole collection is displayed correctly in the Immediate window, but mousing over any of the items in the code window show the same problem.
I shut down Excel and started it up again. I rebooted my PC. I tested it in two copies of Excel (one on a remote desktop for my client in Michigan—I think they use Office 365—and the other on my own Office Pro Plus 2019 here at home). Can anyone tell me what, if anything, I'm doing wrong? Also if it's Excel, a nice workaround would be convenient. At this point I'm thinking I'll just have to put a statement in my program to check for "AJ" and stop if it's found.
Usually in the VBE I can mouse over a variable to see its value, for example I might see this popup:
Code:
va = "AJONES BBRIDGES HTHOMAS"
Code:
va = "AJONES BBRIDGES
Code:
va =
The trigger, after much experimentation, seems to be, simply, the appearance of the letters "AJ" anywhere in the string. They must be upper case, and they must be adjacent, and they must be in that order.
It gets weirder: 1) I wondered whether one of the spaces might really be a CR or LF, but I typed the string manually into the program and it still errs. 2) The string is displayed properly in the Immediate window; when I ask "?va" I see nothing wrong there. 2) Len(va) correctly tells me the length of the string, both in the code and the Immediate window.
But wait, there's more! I split the string; in the Immediate window all the values in the array display correctly, but a mouseover of each element in the code window shows the same error for the particular word that contains "AJ"; the other words show correctly. I assign each element of the array to a collection; the whole collection is displayed correctly in the Immediate window, but mousing over any of the items in the code window show the same problem.
I shut down Excel and started it up again. I rebooted my PC. I tested it in two copies of Excel (one on a remote desktop for my client in Michigan—I think they use Office 365—and the other on my own Office Pro Plus 2019 here at home). Can anyone tell me what, if anything, I'm doing wrong? Also if it's Excel, a nice workaround would be convenient. At this point I'm thinking I'll just have to put a statement in my program to check for "AJ" and stop if it's found.