Microstation Form Export

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

 

 

Parents
  • Unknown said:
    Dim myShell As New Shell32.Shell

    It shows me that the line "Dim myShell As New Shell32.Shell"   is wrong

    You're asking the MicroStation Programming Forum why a Microsoft reference to Shell32.Shell doesn't work in a Microsoft product Excel VBA?

    That's really a question for a Microsoft Forum.  However, I would start by adding a reference to the Shell32 DLL in your Excel VBA project.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: kevindragonduong 

Reply
  • Unknown said:
    Dim myShell As New Shell32.Shell

    It shows me that the line "Dim myShell As New Shell32.Shell"   is wrong

    You're asking the MicroStation Programming Forum why a Microsoft reference to Shell32.Shell doesn't work in a Microsoft product Excel VBA?

    That's really a question for a Microsoft Forum.  However, I would start by adding a reference to the Shell32 DLL in your Excel VBA project.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: kevindragonduong 

Children
No Data