====== Microsoft Excel - Macros - Display - Display a message to the user ====== ' Displays a message to the user, optionally adding in how long the process ran and the queryname. ' Depending on the Developer Control settings it will display a System modal message. Function Message(msg As String, Optional elapsedtime As Single, Optional queryname As String) Dim msg_to_show As String msg_to_show = msg If Not IsMissing(elapsedtime) And elapsedtime > 0 Then If msg_to_show <> "" Then msg_to_show = msg_to_show & vbCrLf & vbCrLf End If If Not IsMissing(queryname) Then msg_to_show = msg_to_show & "The query """ & queryname & """ took " & elapsedtime _ & " seconds to run." Else msg_to_show = msg_to_show & "The query took " & elapsedtime & " seconds to run." End If End If If ctrl_use_system_modal_messages = True Then If Not IsMissing(queryname) Then MessageBox &H0, msg_to_show, wb_name & "-" & queryname, vbSystemModal Else MessageBox &H0, msg_to_show, wb_name, vbSystemModal End If Else MsgBox msg_to_show End If End Function