I am unsure as to how I can achieve a method which returns a string in vba. In c# for instance I can call a method like;
public string ReturnString()
{
    return "Hi";
}
However, if I want to call code in VBA which will also return a string, how do I achieve it? For example if I want my onclick event to return a string of emails;
Public Function EmailAll() As String
    Dim employeeSQL As String
    Dim employeeRS As DAO.Recordset
    'Define SQL to loop
    employeeSQL = "SELECT * FROM Employees"
    Set employeeRS = CurrentDb.OpenRecordset(employeeSQL)
    If Not employeeRS.BOF And Not employeeRS.EOF Then
        employeeRS.MoveFirst
        While (Not employeeRS.EOF)
            If Nz(employeeRS.Fields("email"), "") <> "" Then
                'Fields to return
                EmailAll = EmailAll & email & ";"
            End If
            employeeRS.MoveNext
        Wend
    End If
    employeeRS.Close
    Set employeeRS = Nothing
End Function
 
     
    