Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1677

Running a VBA from a autorunning VBA?

$
0
0

I am auto-running a VBA programme on every file open using clsDGNOpenClose (AskInga), this is checking what file extension is being used and then running another VBA based on one of two file types. (This is to set the level colours in V7 as we are forced by a client to continue to work in this restrictive version).

The automation is working in my tests but for the second VBA to function (setting the level colours) the Level Manager Dialog needs to be open - I am using CadInputQueue.SendCommand "Levelmanager dialog open" however, when it opens it is not displaying any levels until I manually select the filename in the tree list.

When I run the keyin the manually outside of VBA the file is auto highlighted and the levels displayed, I have also tried running just the keyin from a simple VBA module and it works.

It seems to be something to do with the clsDGNOpenClose class but I don't fully understand how the class is controlled.

I hope you may have some suggestions on how to resolve this.

Here is the main chunk of my code:

 

Private Sub m_OpenCloseHooks_OnDesignFileOpened(ByVal DesignFileName As String)
     
    
    'Define variables
    CadInputQueue.SendCommand "Levelmanager dialog open"
   
    Dim DgnFileName As String
Dim DgnFileName1 As String
    With ActiveWorkspace
     
        DgnFileName = ActiveDesignFile.Name
        
Dim pos As Integer

DgnFileName1 = ActiveDesignFile.Name
pos = InStrRev(DgnFileName, ".")
If pos > 0 Then
DgnFileName1 = Left(DgnFileName, pos - 1)
End If
       
Debug.Print "DgnFileName= "; DgnFileName
Debug.Print "DgnFileName1= "; DgnFileName1

Dim MyNote As String
Dim MyNote1 As String
Dim Answer As String

    'Place your text here
    MyNote = "Your file is:" & Chr(13) & Chr(13) & DgnFileName1 + (".lay")
    MyNote1 = "Your file is:" & Chr(13) & Chr(13) & DgnFileName1 + (".ach")
   
If DgnFileName = DgnFileName1 + (".lay") Then

LayModule

       
        Else
       
        Debug.Print "not ACH file"
       
If DgnFileName = DgnFileName1 + (".ach") Then

ArchModule
        
        Debug.Print "not LAY file"
       
      End If
      End If
     
      End With


Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>