View Single Post
  #1   Report Post  
Horus Horus is offline
Junior Member
 
Location: Lund, Sweden.
Posts: 5
Question Second run of macro hangs on .show of application.filedialog object!

Dear All!

I am new to this forum and quite new on programming Excel VBA as well, but here goes...

I am programming a module containing a Sub that employs the application.filedialog object to get the path to a folder from the user.

It works fine the first time I run it after starting Excel, but it hangs when I attempt it the second time. I use the Task Manager to close Excel and get the message that "The system cannot end this program because it is waiting for a response from you".

I think that I understand as much as that the filedialog object belongs to the Excel application as such and I guess it somehow persists between my macro runs. I also assume that somewhere in my macro I am doing something to change its state and cause it to malfunction the second time around.

I could post some code, but thought that a quick fix would be if it was somehow possible to reset or reload the filedialog object from scratch. I have not found such a possibility and to my surprise I have not been able to find any one else describing this issue on this or other forums.

Any help would be greatly appreciated!