Results 1 to 5 of 5

Thread: basic question on parameters

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    basic question on parameters

    Within a macro I call a function with the parameters a, b and c.
    The definition of the function has parameters d, e and f.

    In order to debug it, do I need to put a watch on a, b and c or on d, e and f?

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: basic question on parameters

    Quote Originally Posted by pickarooney
    Within a macro I call a function with the parameters a, b and c.
    The definition of the function has parameters d, e and f.

    In order to debug it, do I need to put a watch on a, b and c or on d, e and f?

    What do you mean by "watch"?

    What I normally do when debugging is to add MsgBox and then the variable to be checked at various points through the routing - that way you can tell any results that should not be there.

    Can you elaborate on your porblem?

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: basic question on parameters

    Quote Originally Posted by sciguyryan
    What do you mean by "watch"?
    From the IDE, click Debug/Add Watch

    At least, that is the way it is in VB. I've no idea about Excel (and, because you use the term "macro", I'm assuming you are using Excel VBA not VB)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    Re: basic question on parameters

    Sorry, I should have specified it was a Word VBA macro. I assumed the IDE was the same. It seems I need to put watches on the d,e and f variables, going by the results I'm getting so far.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: basic question on parameters

    It all depends on what you actually want to watch and how the arguments (or parameters) are passed to your function, ByVal or ByRef. If they are passed ByVal the function can not change the origional variables values. Do you want to watch them while the function is running? In that case you need to watch the d, e, and f, but if you want to watch what has happen with the origional variables when the function has returned you must of course watch the a, b, and c variables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width