VBA Microstation Folder Search

i currently have this code in one of the macros for work. It is located under a button for browsing which folder to look into, and it will get the .DGNs and add them to a listbox.

I don't quite understand the code fully and was hoping someone can give me a quick run down. Also, the code only looks at the selected folder for .DGNs, i want it to look into sub folders as well, is that possible?

Dim myFSO As New Scripting.FileSystemObject
    Dim myFolder As Scripting.Folder
    Dim myFile As Scripting.File
    Dim myShell As New Shell32.Shell
    Dim myRootFolder As Shell32.Folder3
    Set myRootFolder = myShell.BrowseForFolder(0, "Pick", 0)
    If myRootFolder Is Nothing Then Exit Sub

    Set myFolder = myFSO.GetFolder(myRootFolder.Self.path)
    txtCurrentFolder.Text = myRootFolder.Self.path
    lstFilesInFolder.Clear
    For Each myFile In myFolder.Files
        Select Case UCase(Right(myFile.Name, 3))
            Case "DGN"
                If IsFileIn(myFile.path, lstFilesToProcess) = False Then
                    lstFilesInFolder.AddItem myFile.path
                End If
        End Select
    Next
Parents
  • Unknown said:
    I don't quite understand the code fully and was hoping someone can give me a quick run down

    Your code has little to do with MicroStation — it's generic Windows folder searching.  You can find plenty of information about that on Microsoft and other forums that deal with VB/VBA/VBScript.  Some are mentioned here.  Probably a good place to start would be wherever you found your code.

    Step throught the code in debug using function key 8 (F8).

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    I don't quite understand the code fully and was hoping someone can give me a quick run down

    Your code has little to do with MicroStation — it's generic Windows folder searching.  You can find plenty of information about that on Microsoft and other forums that deal with VB/VBA/VBScript.  Some are mentioned here.  Probably a good place to start would be wherever you found your code.

    Step throught the code in debug using function key 8 (F8).

     
    Regards, Jon Summers
    LA Solutions

Children
No Data