René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

ByRef [VBA]

option explicit

public sub by_ref()

  dim str as string

  ' str is not modified by sub if sub_byref is called with without CALL

  str = "calling sub without 'call'"
  sub_byref(str)
  msgBox "str after calling sub_byref: " & str

  ' str is modified by sub if sub_byref is called with CALL

  str = "calling sub WITH 'call'"
  call sub_byref(str)
  msgBox "str after calling sub_byref: " & str

end sub


private sub sub_byref(byref s as string)

  msgBox ("s: " & s)
  s = "modified in sub_byref"

end sub
See also other VBA stuff