I currently have two sub procedures:
[1] The first sub procedure logs in to a password protected website, navigates that website, clicks a link that download's a *.csv file, opens the *.csv file, logs out of the website, and then closes Internet Explorer.
[2] The second sub procedure figures out which of the open workbooks contains the *.csv file information, determines how many rows and columns of data are in Sheet1 of that file, and then copies all of the information to the original Excel spreadsheet.
If I run the first sub procedure and then the second sub procedure, one at a time, the application works as intended. However, if I create a sub procedure that calls the two sub procedures consecutively the second sub procedure won't execute because it doesn't realize that the *.csv file is open because it doesn't open until I manually press ESC to exit the VBA code.
I thought that by employing Application.Wait I could get around this problem. However, when I do that the application hangs, as it should, but the *.csv doesn't open until, again, I manually exit the application since the program gets stuck. It's as if the Application.Wait is telling Excel and VBA to wait, but this just causes the *.csv to delay opening, which is not the intended result.
Any ideas?
[1] The first sub procedure logs in to a password protected website, navigates that website, clicks a link that download's a *.csv file, opens the *.csv file, logs out of the website, and then closes Internet Explorer.
[2] The second sub procedure figures out which of the open workbooks contains the *.csv file information, determines how many rows and columns of data are in Sheet1 of that file, and then copies all of the information to the original Excel spreadsheet.
If I run the first sub procedure and then the second sub procedure, one at a time, the application works as intended. However, if I create a sub procedure that calls the two sub procedures consecutively the second sub procedure won't execute because it doesn't realize that the *.csv file is open because it doesn't open until I manually press ESC to exit the VBA code.
I thought that by employing Application.Wait I could get around this problem. However, when I do that the application hangs, as it should, but the *.csv doesn't open until, again, I manually exit the application since the program gets stuck. It's as if the Application.Wait is telling Excel and VBA to wait, but this just causes the *.csv to delay opening, which is not the intended result.
Any ideas?