' --------------------------------------------------------------------- ' This code was developed for early releases of MicroStation VBA ' that did not use the Message Center. If you're using a version ' of MicroStation later than V8.1, MVBA already has an OutputMessage ' subroutine that behaves like this example ' --------------------------------------------------------------------- ' MessageCenter.bas illustrates how to use MicroStation's Message ' Center to communicate with your program's users. ' Although MicroStation VBA (MVBA ) provides no explicit call to the ' Message Center, it's easy enough to use the MDL function declared ' below. The VBA public subroutine ShowMessage encapsulates the ' MDL function. ' ' Copy this code into your VBA project in a module called Utilities, ' along with all the other stuff you use regularly. Then send messages ' using this call: ' ShowMessage "short message", "longer message" ' ' A useful feature of the Message Center is the MessagePriority value ' MESSAGE_DEBUG. When you make the call in this form: ' ShowMessage "short message", "longer message", MESSAGE_DEBUG ' your user sees the message only when the Message Center property ' Debug is enabled ' --------------------------------------------------------------------- ' Notice: ' Sample code provided by LA Solutions Ltd. ' This code is supplied with no claim for fitness for ' purpose and is not supported. You may freely copy this code ' provided this notice is retained in full. ' --------------------------------------------------------------------- ' For more VBA tips visit our web site ' http://www.la-solutions.co.uk/content/Publications.htm ' --------------------------------------------------------------------- ' For OutputMessage Public Enum MessagePriority ' From MESSAGE_ERROR = 10 MESSAGE_WARNING = 11 MESSAGE_INFO = 12 MESSAGE_DEBUG = 13 MESSAGE_OLDSTYLE = 14 MESSAGE_TEMPRIGHT = 15 MESSAGE_TEMPLEFT = 16 End Enum ' --------------------------------------------------------------------- ' MDL Function Prototypes ' --------------------------------------------------------------------- Private Declare Function mdlOutput_messageCenter Lib "stdmdlbltin.dll" (ByVal MessagePriority As Long, ByVal sBriefMessage As String, ByVal sDetailedMessage As String, ByVal openAlertBox As Long) As Long ' --------------------------------------------------------------------- ' ShowMessage sends a terse message and optionally a verbose ' message to MicroStation's message centre ' Example call: ' ShowMessage "short message", "long message with more detail", MESSAGE_ERROR, True ' --------------------------------------------------------------------- Public Sub ShowMessage(ByVal terse As String, Optional ByVal verbose As String = vbNullString, Optional priority As MessagePriority = MESSAGE_INFO, Optional popDialog As Boolean = False) If (vbNullString = verbose) Then mdlOutput_messageCenter priority, terse, terse, popDialog Else mdlOutput_messageCenter priority, terse, verbose, popDialog End If End Sub ' ---------------------------------------------------------------------