Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Variable Case issue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Variable Case issue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Variable Case issue

.... 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Variable Case issue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Variable Case issue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Variable Case issue

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Variable Case issue

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 lower case o (Oh) print issue GT_NC Excel Discussion (Misc queries) 0 November 11th 08 09:19 PM
Pivot Table Heading Fields - case sensitivity issue Club Internet Excel Discussion (Misc queries) 0 June 8th 06 10:08 PM
Select Case - issue George Excel Discussion (Misc queries) 7 March 17th 06 05:22 AM
Upper Case and date format issue Andy Tallent Excel Discussion (Misc queries) 3 April 8th 05 04:52 AM
Case statement in variable range TP[_3_] Excel Programming 1 August 23rd 03 05:14 PM


All times are GMT +1. The time now is 12:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"