View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Pls explain this VBA oddity

i often use this or similar variablenames for testing an idea. I also
forget them a lot....


Just because the code may have been "professionally" developed, doesn't mean
the developer didn't do something like this, then forget to clean it up.
Once something works, there is often not time (nor need) to make it more
elegant.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"carlo" wrote in message
...
as it is a sub it cannot return a value.
And if the Variable is declared inside the sub the scope should be
inside it as well. I don't know if you can get access to that
variable, but i'd say 99% no. I'm not a professional, maybe somebody
else can give you a more satisfying answer to that.

Another thing what makes me think it is dummycode is the name of the
variable "foobar" (http://en.wikipedia.org/wiki/Foobar)
i often use this or similar variablenames for testing an idea. I also
forget them a lot....you don't have by any chance one of my codes,
right?? hehe, just kidding, sorry!

Well, that's my point of view....maybe somebody else will contribute
something as well.

Cheers Carlo


On Dec 18, 4:54 pm, wrote:
On Dec 17, 11:38 pm, carlo wrote:

It looks like dummy code.....the author maybe forgot to delete it.


You could be right. There is other code in the project that is
commented out. Hmm, maybe I am wrong about my assumption that the
code is professionally developed.

(The code I am looking was developed some years ago, according to
comments. It is not currently under development.)

put ' in front of those two lines and check if there are problems.


Problem is: I am just looking at the code in VBE. I have not enabled
macros for fear of hidden dangers.

But in my opinion, without seeing the code, you don't need this
variable.


Probably right. But I have one other "wild ass thought" for
consideration.

The code is in a sub. If the sub were called from another VBA
procedure, could the sub access variables that are declared in the
calling procedure(!)?

That would surprise me. But I vaguely some computer language that did
permit that -- kinda like #define's in C. (But of course, references
to #define's merely substitute text; they are not actual calls.)

It's probably a moot point anyway because I cannot find any place
where the "useless" sub is called -- bolstering your theory that the
sub is either vestigial or dummy code. Still curious, though.

Thanks again for any insights.