Learning MicroStation VBA

Chapter 19: Using MicroStation's Built-In User Forms

One ways to increase your speed in developing applications is to use of existing code, objects, and interfaces.

Declaring MicroStation User Form Functions

Access MicroStation's built-in User Form functions by using a DLL (Dynamic Link Library). When functions are wrapped in a DLL, they must be declared before they are used. Make these declarations in the general declarations area of a code module.

Declare Function mdlDialog_openAlert Lib _"stdmdlbltin.dll" (ByVal stringP As String) As Long

Here is the declaration for the OpenAlert dialog box. Let's break up the declaration into its individual parts:

Declare Function

Tells VBA we are going to declare a function that is part of a DLL file.

mdlDialog_openAltert

The name of the function we are declaring.

Lib "stdmdlbltin.dll"

The name of the DLL Library the in which the function is contained.

(ByVal stringP as String)

Parameters for the function. Can be empty () or contain one or more parameters.

As Long

The return type of the function.

One of the distinguishing features of a function is that it returns a value. "mdlDialog_openAlert" returns a Long value. Some functions in DLLs need to return more than one value. They do this by changing the values of variables we supply into the function's parameters.

Here is the declaration for the FileOpen Function:

Declare Function mdlDialog_fileOpen Lib _"stdmdlbltin.dll" (ByVal _fileName As String, ByVal rFileH As Long, ByVal _resourceId As Long, ByVal suggestedFileName As String, _ByVal filterString As String, _ByVal defaultDirectory As String, _ByVal titleString As String) As Long

To open...

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: Photovoltaic (PV) / Solar Combiners
Finish!
Privacy Policy

This is embarrasing...

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