View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
monir monir is offline
external usenet poster
 
Posts: 215
Default ByVal Target As Range

Jim Thomlinson :: PaulD ;

Very informative and educational responses!
Thank you very much.


"PaulD" wrote:

Let's try to answer this one at a time.

"monir" wrote in message
...
: In standard worksheet and workbook events, the Sub argument lists include
: some "mysterious" argument components, such as: ByVal Target As Range,
Cancel
: As Boolean, ByVal Sh As Object, etc.
:
: The VBA Help states that ByVal (and ByRef) can be used with Call only when
: calling a DLL procedure !!

Is this a question or statement?

: a. Do standard / custom events automatically call a DLL procedure, and
thus
: their argumentlist must include ByVal ??

Not necessarily, each is different and may or may not call a DLL. The
arguement list in an event subroutine is different than one in a call
statement

: b. Are Target, Cancel, Sh, Wn, etc. Keyword variable names ??

As Jim states, they are not keywords and can be used in code

: c. Can one use, for example, the variable name Target in the procedure ??
: after assigning an object reference to it: Set Target = ??

Normally the event will assign a value to Target so you can see what the
range was that was active or in use when the event occured. You could
overwrite the value of Target with your own Range but I would question why,
just create a new variable.

: d. If Target is not used or can not be used, can one omit Target As Range
: from the argumentlist ??

For your own subs or functions, you can use or omit any arguments as
required. For the built-in events, why would you need to delete any
arguments, just leave them as provided. As stated earlier, they are not
keywords so you can overwrite them if you feel you must

: Thank you.

Hope this helps
Paul D