Problem uploading file with IE

ricksimm

Board Regular
Joined
Apr 28, 2005
Messages
188
Code:
        Dim IE As Object
        Set IE = CreateObject("InternetExplorer.Application")
        IE.Visible = True
        IE.Navigate "http://www.custwebsite.com"
        Do
                If IE.ReadyState = 4 Then
                            IE.Visible = False
                            Exit Do
                    Else
                            DoEvents
                End If
        Loop
        IE.Visible = True
        SendKeys "username", True
        Application.Wait (Now + TimeValue("0:00:02"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "password", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{ENTER}", True
        Application.Wait (Now + TimeValue("0:00:04"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{ENTER}", True                                ' admin functiond
        Application.Wait (Now + TimeValue("0:00:04"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys textfile.txt                                         ' insert upload file name
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{END}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{TAB}", True
        Application.Wait (Now + TimeValue("0:00:01"))
        SendKeys "{ENTER}", True
I use this code to start IE, navigate to a webpage, insert username and password, insert a file name to upload, then TAB to the UPLOAD button and sendkey an ENTER. Most of the waits are so I can watch the process. Everything works fine till I sendkey the ENTER on the UPLOAD button. The first thing that happens is I start getting the slow green progress bars and an eventual failure. Rather than waiting for the failure I use the IE STOP button. Then, if I press enter or click on the UPLOAD button the upload function works perfectly. (using XP and Excel 2007) Any suggestions? Thanks.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,225,345
Messages
6,184,394
Members
453,229
Latest member
Piip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top