Rubberduck icon indicating copy to clipboard operation
Rubberduck copied to clipboard

"Non-returning function" error if the assignment is done using "With"

Open interservices opened this issue 2 years ago • 0 comments

Version 2.5.2.5906 OS: Microsoft Windows NT 10.0.22000.0, x64 Host Product: Microsoft Office x64 Host Version: 16.0.15225.20288 Host Executable: EXCEL.EXE


I get the error "Return value for member 'assigner' is never assigned" here:

Private Type tipo
    one As Long
    two As Long
End Type

Function assigner() As tipo
    With assigner
        .one = 1
        .two = 2
    End With
End Function

If I don't use the "With" statement using the direct "assigner.one = 1: assigner.two = 2" I don't get the error.

interservices avatar Jun 27 '22 16:06 interservices