Results 1 to 9 of 9

Thread: Check if function has been called as sub

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    No, I am asking what is the point? What is wrong with this.

    Sub TestFunction()
        Dim res1Of1 As Long
        Dim res1Of2 As Long
        Dim res2Of2 As Boolean
        Call OneOrTwo(3, res1Of1)
        MsgBox res1Of1
        res2Of2 = OneOrTwo(5, res1Of2)
        MsgBox res1Of2
        MsgBox res2Of2    
    End Sub
    
    Function OneOrTwo(ByVal inp As Long, ByRef out As Long) As Boolean
        out = 2 * inp
        OneOrTwo = out > 5
    End Function
    One function to rule them all, one function to find them, one function to bring them all and in the darkness bind them ... does it all.
    Last edited by Bob Phillips; 08-29-2020 at 02:05 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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