Function dispYN(sMsg As String, Optional vModal) ' 'Version: 1.000 'Purpose: Displays a Y/N dialog and returns true if Yes is pressed otherwise returns false On Error Resume Next Dim lResponse As Long Dim bModal As Boolean lResponse = MsgBox(sMsg, vbQuestion + vbYesNo, "") If lResponse = vbYes Then dispYN = True Else dispYN = False End If DoEvents ' to allow repainting End Function Newer verisioin Function dispYN(sMsg As String, Optional vDefault, Optional vModal) ' 'Version: 1.001 'Purpose: Displays a Y/N dialog and returns true if Yes is pressed otherwise returns false if IsMissing(vDefault) then 'have to run because default set else if gbJustRun Then dispYN = vDefault Exit Function End If End If On Error Resume Next Dim lResponse As Long Dim bModal As Boolean if IsAutorun Then dispYN = True else lResponse = MsgBox(sMsg, vbQuestion + vbYesNo, "") If lResponse = vbYes Then dispYN = True Else dispYN = False End If DoEvents ' to allow repainting End If End Function |