programmatically load and start MVBA out of MVBA

Hello Community,

I'm wondering whether it is possible to load and run MVBA as part of another MVBA Project. Means I've go a VBA Project from which I'd like to start other applications. I've got the following source code as an example but with VBA LOAD I can't run the precedure twice without an error occuring.

Public Sub start_DGNImp()
    CadInputQueue.SendCommand "vba load \\server\share\vba\DGNImp.mvba"
    CadInputQueue.SendCommand "vba run [DGNIMP]modTextCommands.DGNIMP"
End Sub

Just RUN VBA doesn't work for me. I know there are ways to check whether MDL applications are loaded but didn't find an adequate way to do that with VBA.

Hope someone can help with that.

Regards,
Maik

Parents Reply
  • Finally I found for what I was looking for.

    I can use the Microsoft Visual Basic for Applications Extensibility Library and you were right, it's not a Microstation specific question.

    And there is an example coming with Microstation Installation called VBE_Tools.mvba showing how to use it.

    So my function now looks like the following, where I loop through all the loaded VBA projects:

    Private Function isProjectLoaded(ByVal projectName As String) as Boolean
        isProjectLoaded = False
        Dim oProject    As VBIDE.VBProject
        Dim oProjects  As VBIDE.VBProjects

        Set oProjects = VBE.VBProjects
           
        For Each oProject In oProjects
            If UCase(oProject.Name) = UCase(projectName) Then
                isProjectLoaded = True
            End If
        Next
    End Function

    With regards,

    Maik

Children
No Data