ok, one question: why is there the 20 second delay after the Sendkeys?
I have two suggestions to try:
this is some code I wrote to open a new ie page (navigating to Google), waiting until ie ready, then pasting some previously copied text ("FText") from the ClipBoard.
maybe you can substitute the Google line with your web address for the file. The programme pauses until ie is ready but then i found that I had to introduce the 4 second delay before pasting in the Clipboard using the Sendkeys CTRL V but you'll need to change this to "O" (see comment on Sendkeys below).
Also make sure that you have the right References checked ("Tools", "References") as I think you might need the Microsoft Internet Controls ref checked. (Might be wrong though...)
Alternatively, you could put the sendkeys and Windows.Activate command in a separate sub (YourSubName) and use the following Code to call the sub to run after a period of time (in this case 20 seconds) and then sub continues with the rest. if the time is sufficient, this should allow ie to catch up and be ready for the sendkeys commands that you sent earlier.
To see how the Ontime works, paste the following into a new module of a new book and then run the "testontime" macro to see what happens.
Lastly, using Sendkeys can be temperamental and I've found that using/not using brackets (as in my example) can make a difference. Just have to try the different approaches I'm afraid.
Bookmarks