- Trained on our vast library of engineering resources.
Learning MicroStation VBA

Chapter 9: Standard VBA Calls

While introducing various concepts, we used a number of standard VBA calls without discussing them, so let's cover them now. Again, you can use these VBA calls with other VBA-enabled applications such as Microsoft Excel.

MessageBoxes

We used MessageBoxes to display some text with an OK button. By default, the code pauses until the user clicks the OK button.

Sub <b class="bold">TestMessageBox1</b>()    MsgBox "Your hard drive will now be formatted."End Sub

This is just what we all want to see: A MessageBox informing us something drastic is about to happen and all we have is an OK button to click on.

You can specify the prompt of the MessageBox (the text that shows up) as well as which buttons display.

Sub <b class="bold">TestMessageBox2</b>()    Dim MsgResp As VbMsgBoxResult    MsgResp = MsgBox("Unable to open file.", vbAbortRetryIgnore)    MsgResp = MsgBox("Format Hard Drive?", vbOKCancel)    MsgResp = MsgBox("New Level Added.", vbOKOnly)    MsgResp = MsgBox("Not Connected to Internet.", vbRetryCancel)    MsgResp = MsgBox("Do you want to continue?", vbYesNo)    MsgResp = MsgBox("Continue Reading File?", vbYesNoCancel)    Select Case MsgResp        Case VbMsgBoxResult.vbAbort            'Place Code Here        Case VbMsgBoxResult.vbCancel            'Place Code Here       ...

UNLIMITED FREE ACCESS TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DC-DC Converter Chips
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.