Function Returning Boolean? Function Returning Boolean? vba vba

Function Returning Boolean?


function MyFunction() as Boolean    .....    .....    MyFunction = True 'workedend functiondim a as boolean = MyFunction()


In VBA, you set a function's return value by assign to a variable with the same name as the function:

Function MyFunc() as Boolean    MyFunc = TrueEnd Function


I suspect you may be using VBScript instead of VBA? If that's the case then VBScript doesn't state Type

this will work in VBScript

dim test,btest = 1b=falsemsgbox ("Calling proc before function test=" & test)msgbox("Calling proc before function b=" & b)b = A(test)msgbox ("Calling proc after function test=" & test)msgbox("Calling proc after function b=" & b)Function A(test)test = test +1  A=trueEnd Function

or in your example

Function A()    A=trueEnd Function