问题
This is the most bizarre question I've ever asked. I'm not even sure how to phrase it. I remember something like this happening way back in the VB6 IDE, but I've forgotten the fix. If this is the case, then this is a really old bug in the VB IDE.
Here's the problem:
I'm writing a simple MS Word macro when I accidently typed:
Dim cell as Cell
This activated the dreaded IDE bug. Now, no matter what I do; remove the module, edit it outside the IDE or whatever, the IDE's intellisense formats the variable type "Cell" as "cell"
If I name a new variable:
Dim tcell as Cell
The IDE changes it to:
Dim tcell As cell
This infuriates me to no end. I've tried everything to no avail. This happens even if I edit the module file (.bas) outside of the IDE and reimport it back.
How can I stop this madness?
Updated
Apparently this behavior is not a bug, but by design. See answer.
回答1:
Try putting a
Dim Cell as Cell
somewhere, then delete it and try again... I seem to recall that variable declarations take precedence in setting the casing, thus this should force the casing back to how it should be...
回答2:
VB/VBA variable names are not case sensitive so cell and Cell are the same. I would suggest you name your variables something else - I personally use a letter in front: e.g.
Dim sString as String 's for string
Dim iInt as Integer 'i for integer
Dim oCell as Cell 'o for objects
Hope this helps
来源:https://stackoverflow.com/questions/6212042/why-does-the-vba-ides-intellisense-in-microsoft-word-2007-keep-on-changing-the