I want to run vba routine by giving parameters also. Is it Possible ? (microstation 8.1/8.5 vba)

I want to run vba  routine by giving parameters also. Is it Possible ?    (microstation 8.1/8.5 vba)

e.g.,

Public Sub ShowFea (intScale as Integer, lngFeaCode as long)

'todo: ....

End Sub



i want to run it by writing following command:

vba run showFea (1,2002)


Is it Possible ?    (microstation 8.1/8.5 vba)
  • Unknown said:
    I want to run VBA routine by giving parameters

    Yes: the MicroStation VBA KeyinArguments Property.  Search for KeyinArguments in VBA Help for examples.

     
    Regards, Jon Summers
    LA Solutions

  • However, it is different than the standard arguments of a sub or function. There are no parenthesis or type declarations of the arguments.

    Here is an example:

    Public Sub Scal()

       On Error GoTo Handle_Error

    '----------------------------------------------------

    ' sets the appropriate cell scale factor (as=)

    ' If "yes" is passed, then it uses the active

    ' drawing scale... if "no", then as=1

    '----------------------------------------------------

       Dim dblScale As Double

       Dim strApplyScale As String

       strApplyScale = KeyinArguments

       If strApplyScale = "no" Then

         'set pattern scale = 1

           CadInputQueue.SendCommand "ps=1"

         'set terminator scale = 1

           CadInputQueue.SendCommand "ts=1"

         'set cell scale = 1

           CadInputQueue.SendCommand "as=1"

         'turn off linestyle scale

           SetCExpressionValue "tcb->lineStyle.modifiers", 0&, "LSTYLE"

       ElseIf strApplyScale = "yes" Then

         'read current drawing scale

           dblScale = DrawingScaleFactor

         'set pattern scale to drawing scale

           CadInputQueue.SendCommand "ps=" & CStr(dblScale)

         'set terminator scale to drawing scale

           CadInputQueue.SendCommand "ts=" & CStr(dblScale)

         'set cell scale to drawing scale

           CadInputQueue.SendCommand "as=" & CStr(dblScale)

         'set linestyle scale and enable

           SetCExpressionValue "tcb->lineStyle.scale", dblScale, "LSTYLE"

           SetCExpressionValue "tcb->lineStyle.modifiers", 1&, "LSTYLE"

    '      'multiply the text height by this factor for symbol font points

    '        CadInputQueue.SendCommand "tx=*" & CStr(dblScale)

       End If

    Exit_Scal:

       Exit Sub

    Handle_Error:

       LogError "[IDS]mBarmenu - Scal"

       GoTo Exit_Scal

    End Sub


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration
    Maryland DOT - State Highway Administration User Communities Page

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996