String to MicroStation Master Unit Conversion

MicroStation allows users to input units as Sub Units by preceding the value with either a colon, “:6”, or two dots, “..6”. Users may also enter unit values in MU:SU:PU format. In MicroStation dialogs these input formats are automatically converted to their Master Unit equivalents. Unfortunately when writing your own VBA macros in MicroStation there is no automatic conversion. It is up to the macro developer to do this conversion. The StringToMasterUnits function below can be used to test an input string value and convert the various input formats to master units.

Public Function StringToMasterUnits(ByRef strIn As String, ByRef dOut As Double) As Boolean Dim strSplit() As String Dim dMU As Double Dim dSU As Double Dim dPU As Double Dim i As Long Dim iStart As Long Dim iEnd As Long