+ Reply to Thread
Results 1 to 2 of 2

By Val & By Ref.

  1. #1
    Registered User
    Join Date
    12-02-2007
    Posts
    1

    By Val & By Ref.

    Hi forum,


    I m new to vba.I had seen many functions on net about By val & By Ref parameters in a functions and procedure.I want to Know when these are used and how to use them.please post any examples explaining the above parameters.

    Thanks.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: By Val & By Ref.

    if you pass a parameter byval you pass a copy of the variable which your called code can manipulate without affecting the original variable. if you pass it byref you pass a pointer to the original variable and any changes made to the variable affect the original variable as well. if your parameter is an object and you pass it byval you actually pass a copy of the pointer so changes will affect the original object but you cannot change which object the variable refers to

    which to use depends on the situation but the default is byref if your code does not specify byval
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1