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
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:I want to check whether it's loaded or not in order to avoid that message.
In my opinion it would be more consistent with MicroStation configuration style to define what MVBA files will be loaded using configuration variable.
I am not sure if one macro can check if another macro is loaded, but it seems to be more general VBA question than a specific MicroStation issue.
With regards,
Jan
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 NextEnd Function
Maik