Hi,
I have created a microstation macro that can search for all ".DGN" files in a specific folder that the user chooses. below is the code i have written to do so:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Private Sub btnBrowse_Click()
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 End Sub
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have exported the form from this microstation macro and have imported it into an excel macro, right now i have the microstation form show when i click a button on the excel spreadsheet. When i click the browse button so i can choose the folder i want to look into (btnBrowse), i get an error message saying "Compile error: User-defined type not defined"
and when i click ok, it shows me that the line "Dim myShell As New Shell32.Shell" is wrong or has an error (highlighted yellow). I do not know why it is giving me that error, need help on this please.
Thank you