RB Smissaert said:
Thanks Bob, that is reassuring.
This looks like a bug in VBA to me.
Any idea where this could be stored?
The object browser shows (as expected) the normal casing, Bold.
RBS
As Mr. Phillips noted it is common enough - but not so common that it
isn't
surprising when it happens.
It comes about because of the "interpreted" nature of VBA, and the complex
symbol tables VBA creates as it flows along (during development). This is
'stored' as pcode or sometimes called OpCode in the VBA world. Just as in
VB
the 'text' portion of the code that you see in the editor is actually a
View
to the underlying pcode. When you type something VBA immediately parses it
(syntax checking, symbol table comparisons, etc.) and converts it to
pcode,
this pcode is immediately converted back to text and presented back to the
User. That's where the spelling change happens. (Happens quick doesn't it.
<g>)
[The same thing is happening in VB.]
When doing your own research note that there two subtle flavors of
'OpCode'
in VBA - OpCode and ExCode. OpCode refers to pcode within an Editor.
ExCode
refers to pcode that is packaged up and ready to 'run' - precompiled
pcode.
For example while you have a module open in the editor the code behind is
OpCode. Once you save the module it gets wraps with additional material,
is
rearranged a bit and becomes ExCode. Or to some - ExCode plus OpCode. That
is best left up to the geeks as this is a rather fine distinction since to
us it is just pcode. <g>
While developing a lot of crap builds up. (technical term for additional
information no longer needed). You can get rid of most of this stuff, by
periodically running the module - convert the 'OpCode' to 'ExCode'. You
don't have to excise the whole module just call some subroutine in it.
[That's why in VB a periodic "Start with Full Compile" helps to keep it
'clean', and removes strange errors.]
There used to be a whole list of "things to do" to clean up code (reset
it),
like saving code to a file and reloading it. I don't remember them all -
most were probably wives' tales anyway. <g> Supposedly Office VBA cleaned
up
its act with Office 2000 and beyond (more cleanup when converted to
ExCode).
There must still be some need because I see the occasional "VBA Decompiler
and Cleaner" being sold. These tools cut down module size and appear to
improve performance so apparently things haven't changed that much. Most
full-blown Office developers own one.
This is really the kind of question you should be asking in an Excel
Developer's group. They fool with this on a daily basis.
hth
-ralph