Function and Immediate window

  • Thread starter Thread starter Wavequation
  • Start date Start date
W

Wavequation

This is a stupid question, but I am writing and testing a function.
Shouldn't I be able to type the function name, include any values, and
pressing enter, have the result printed in the immediate window?
as a simple example

function Test(strTest as string) as string
test = strTest
end function

Then typing:
Test("Test String")
in the immediate window should yield:
Test String
Directely below it
 
It should... if the Function is in Public Scope

Often I declare as Public for testing and go back to Private after the
procedure is proofed.

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Whoops!


You need to include ? at the beginning of the line to say you want the
return printed:

?Test("Test String")
Test String

just plain old Test with no ? will run the function but not return the value


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Off the top of my head, you may need to prefix with a ?

?Test("Test String")

in the immediate windows. You also can do this:

debug.print Test("Test String")

which is actually the same thing.

HTH.
 
That's the part I forgot!

Jack Leach said:
Whoops!


You need to include ? at the beginning of the line to say you want the
return printed:

?Test("Test String")
Test String

just plain old Test with no ? will run the function but not return the value


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
I'll even add several Debug.Print statement throughout the statement, and at
the end so I can see what's going on with the function. Doing so eliminates
the need for the '?'
 
Back
Top