Finding Activevbproject.filename

I read the post between Caddcop andJohn, and followed the link, but it failed ? 

Not sure of how old the link is but I did want to read the information. I checked to see if I could just message Caddcop, but name did not show up.

I was hoping someone could furnish a link that might still be good

Parents
  • I was trying to figure out how to use Debug.Print to show the macro names like you can do with 

    Debug.Print ActiveDesignFile.name  ?   I did try to read the link you had posted to CaddCop, but it was apparently not there any more.  

    Example: 

    how or if you can do somekind of a debug.print to show the active file names of the macros. I know you can view them this way and close them this way,  one day I ran the VBA LOAD  ProjectName (whatever) I got the little error message

     or Unloaded 

    I was going to use the If ???  (filename) = False then

                VBA LOAD  ProjectName

    End if

    I read some where on MS page it was something like Activevbproject.filename but unable to get any results

    tried Activevbproject.name did not work. Yet ActiveDesignFile.name will print out he file name ??

    Version: MicroStation V8i SS 10

    RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus

  • Hi Richard,

    Here is a Microsoft VBA code snip I created to iterate all loaded VBA projects listing their full path and file names.

    Make sure to add the Reference needed (in the code snip comment) to your VBA project then run.  It runs fine in MicroStation V8i or CONNECT.

    ' Add: Tools > References: "Microsoft Visual Basic for Application Extensibility 5.3"
    Public Sub VBEProjectsList()    ' WORKING: RH - 2013/10/14
        Dim oVBE As vbe
        Dim oProject As VBIDE.VBProject
        Dim iProjIdx As Integer
        Dim sProjIdx As String
        Set oVBE = Application.vbe
        For Each oProject In oVBE.VBProjects
            iProjIdx = iProjIdx + 1
            sProjIdx = "[" & iProjIdx & "] "
            Debug.Print sProjIdx & " Project Name: " & """" & oProject.Name & """" & ", FullPath: " & oProject.fileName
        Next
    End Sub

    HTH,
    Bob



  • Thank you, 

    I copied your code into new project and then ran 

    debug  this error came up.

    Hard to read:

    ' Add: Tools > References: "Microsoft Visual Basic for Application Extensibility 5.3"
    Public Sub VBEProjectsList() ' WORKING: RH - 2013/10/14
    Dim oVBE As VBE <- was the Dim it did not like, I am trying to use the 

    .mvba program.

    Version: MicroStation V8i SS 10

    RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus

Reply
  • Thank you, 

    I copied your code into new project and then ran 

    debug  this error came up.

    Hard to read:

    ' Add: Tools > References: "Microsoft Visual Basic for Application Extensibility 5.3"
    Public Sub VBEProjectsList() ' WORKING: RH - 2013/10/14
    Dim oVBE As VBE <- was the Dim it did not like, I am trying to use the 

    .mvba program.

    Version: MicroStation V8i SS 10

    RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus

Children