Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a sheet where I originally created a global const as:
Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is a known flaw in the VBA Editor (VB6 also) that when you type the name
of an enum member, the enum declaration is changed to match what you typed rather than the opposite (correct) behavior. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "J Streger" wrote in message ... I have a sheet where I originally created a global const as: Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
.... and what a pain it is !!!!!
-- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Chip Pearson" wrote in message ... It is a known flaw in the VBA Editor (VB6 also) that when you type the name of an enum member, the enum declaration is changed to match what you typed rather than the opposite (correct) behavior. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "J Streger" wrote in message ... I have a sheet where I originally created a global const as: Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is a known flaw in the VBA Editor (VB6 also) that when you type the
name of an enum member, the enum declaration is changed to match what you typed rather than the opposite (correct) behavior. It seems to work a little bit differently in my copy of XL2003. Yes, in VB6, the last time you type the Enum's member name in any statement, the casing in the Enum changes to match it; however, in my copy of Excel, that only seems to happen when I type the Enum's member's name in a dimensioning statement (such as Dim)... using the member's name in a plain (non-dimensioning) statement seems to always adopt the Enum's casing. Rick |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's a bug in the Enum function and it's very annoying (we have the same
sort of problem over in the compiled VB world, but it's a little bit worse over there). Unlike other dimensioning statements in VBA (or compiled VB) which force the casing used to dimension the variable's name, Enum variable names take the casing of the last time their variable name was declared anywhere else (in the compiled VB world, the casing changes to the last time the Enum's variable was typed, whether inside a dimensioning statement or not). You can see this with your own situation. Put this code in any code window... Sub Test() Dim RaMpUp as String End Sub but make sure you type the variable name (don't just copy it). Now go look at the variable name in the Enum block. Notice that the casing of the Enum's variable name has become what was used in the Dim statement of the Test subroutine. Go back to the Test subroutine and change RaMpUp to rampup this time; now look at what happened to the variable name in the Enum block. There is no way to stop this from happening. However, as you can see, you can "fix" your Enum's variable name casing by putting a Dim statement with the correct casing somewhere and then deleting it. Rick "J Streger" wrote in message ... I have a sheet where I originally created a global const as: Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you all. And I agree, it is quite a pain.
But at least I can work around it. -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 "Rick Rothstein (MVP - VB)" wrote: It's a bug in the Enum function and it's very annoying (we have the same sort of problem over in the compiled VB world, but it's a little bit worse over there). Unlike other dimensioning statements in VBA (or compiled VB) which force the casing used to dimension the variable's name, Enum variable names take the casing of the last time their variable name was declared anywhere else (in the compiled VB world, the casing changes to the last time the Enum's variable was typed, whether inside a dimensioning statement or not). You can see this with your own situation. Put this code in any code window... Sub Test() Dim RaMpUp as String End Sub but make sure you type the variable name (don't just copy it). Now go look at the variable name in the Enum block. Notice that the casing of the Enum's variable name has become what was used in the Dim statement of the Test subroutine. Go back to the Test subroutine and change RaMpUp to rampup this time; now look at what happened to the variable name in the Enum block. There is no way to stop this from happening. However, as you can see, you can "fix" your Enum's variable name casing by putting a Dim statement with the correct casing somewhere and then deleting it. Rick "J Streger" wrote in message ... I have a sheet where I originally created a global const as: Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
The problem is more subtle than just the toggling of case whenever you type the enum member. Try this example; Enter the following at the top of a code module. '----------- Const hElLo = 1 Enum XX hElLo End Enum '----------- Then delete the const and try changing the text to HELLO. It remembers the const case structure. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "J Streger" wrote in message ... I have a sheet where I originally created a global const as: Global Const RAMPUP = "RU" Well I decided that rather than that I wanted to do an enumeration. So I deleted the global const and created: Public enum TestTypes RampUp end enum Except that after typing VBA gave me this: Public enum TestTypes RAMPUP end enum In fact, everytime I type rampup in the code it becomes capitalized. I did a search and it exists nowhere in my code. Excel doesn't show it in the object browser, and I restarted Excel, but it seems to have a die hard memory that rampup = RAMPUP. It's done this with 3 other variables I made Global constants and then deleted. Is there a way to stop this from happening? -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 lower case o (Oh) print issue | Excel Discussion (Misc queries) | |||
Pivot Table Heading Fields - case sensitivity issue | Excel Discussion (Misc queries) | |||
Select Case - issue | Excel Discussion (Misc queries) | |||
Upper Case and date format issue | Excel Discussion (Misc queries) | |||
Case statement in variable range | Excel Programming |