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

optional parameters [VBA]

option explicit

public sub optional_parameters 
  dim  ret as string

  ret =  opt_param_func(1, "foo", "bar", 11)
  msgBox ret

  ret =  opt_param_func(2, "hellow world")
  msgBox ret

  ret =  opt_param_func(3, "***", param_3 := "three")
  msgBox ret

  ret =  opt_param_func(4, "!!!", param_4 := 4)
  msgBox ret

end sub

private function opt_param_func ( _
      required_param_1 as string, _
      required_param_2 as string, _
      optional param_3 as string, _
      optional param_4 as string  _
 )    as string


 opt_param_func = "param_1: " & required_param_1 & " " & _
                  "param_2: " & required_param_2 & " " & _
                  "param_3: " &          param_3 & " " & _
                  "param_4: " &          param_4
             

end function
See also other VBA stuff