ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dimmed Keyword as Variable (https://www.excelbanter.com/excel-programming/379524-dimmed-keyword-variable.html)

Zone

Dimmed Keyword as Variable
 
I stupidly dimmed keyword Val as a variant in a userform, type variant,
like this:

Dim HAL, VAL

Now, in every module that Val appears, it as appears as VAL. Yikes! I
found the Dim statement as changed it to

Dim HAL, VVAL

but all the Val statements in other modules still show as VAL.
Obviously, VAL was not dimmed as public, so I don't know why this is
happening! How do I get the VAL in the other modules to return to
their normal capitalization (Val)?

Thanks, James


Zone

Dimmed Keyword as Variable
 
Tom, that is absolutely amazing. The Val keyword appeared to continue
operating properly, even while miscapitalized, as you no doubt know.
Very strange. Your breadth of knowledge is awesome. Thank you. James
Tom Ogilvy wrote:
Try this:

create a variable with the capitalization you want.
Then delete it.


Dim Val


then delete it. Now


r = Val("123abc")


will be capitalized how you expect.


When you create a variable (or property, in your case) that is a keyword,
VBA remembers the capitalization even after you delete the
variable/property. This just tricks into doing it right.

(adaptation of advice previously posted in the newsgroup).

--
Regards,
Tom Ogilvy




"Zone" wrote:

I stupidly dimmed keyword Val as a variant in a userform, type variant,
like this:

Dim HAL, VAL

Now, in every module that Val appears, it as appears as VAL. Yikes! I
found the Dim statement as changed it to

Dim HAL, VVAL

but all the Val statements in other modules still show as VAL.
Obviously, VAL was not dimmed as public, so I don't know why this is
happening! How do I get the VAL in the other modules to return to
their normal capitalization (Val)?

Thanks, James





All times are GMT +1. The time now is 06:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com