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 Reply Children
  • 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

  • ' Add: Tools > References: "Microsoft Visual Basic for Application Extensibility 5.3"

    Did you follow that instruction from

    In the VBA IDE, the menu strip along the top has a Tools menu.  Bob is asking you to use the Tools|References sub-menu to add that reference.

     
    Regards, Jon Summers
    LA Solutions

  • So Sorry I overlooked that tip, no sir I did not. I called myself reading and trying

    Thank You Jon for pointing that out, now that it is on going to try the macro again.

    so glad you took the time to straighten me out. So nicely (((c;  LOL

    Version: MicroStation V8i SS 10

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

  • Jon, sorry to be a pest

    Option Explicit
    Option Base 0
    Option Compare Text
    ' Add: Tools > References: "Microsoft Visual Basic for Application Extensibility 5.3"
    Public Sub VBEProjectsList() ' WORKING: RH - 2013/10/14
    Dim oVBE As VBE   <<<<<<<<<<<<<<<<<<<< Fault Occurred Here, I will comment out and 
    Dim oProject As VBIDE.VBProject <<<<<<< see if it will go any further?? 
    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
    '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.

    Version: MicroStation V8i SS 10

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

  • 's code worked fine for me.  My VBA project is attached.

    EnumerateVbaProjects.mvba

    MicroStation key-in:

    vba run [EnumerateVbaProjects]modMain.Main

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Richard Phillips 

  • Jon First Thank you so much worked great yours

    I will delete mine and use yours. So thank you

    have to get to bed ........... 

    Version: MicroStation V8i SS 10

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