• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to open file by URL clickin on OPEN button in IE10

Hi Team

I have a URL:
http://intranet.dell.com/marketing/...nts/288896/ReqID-288896 GOIR--31230 EMEA.xlsx

I am navigating this URL and i am given an option to click on OPEN or CANCEL.

I have tried many ways to open the file but I am not able to do so.. sendkeys not working.

Please advise me how to achieve this task as I am stucked here


Code:
                    Set internetdata = ie.document
                    Set internetlink = internetdata.getElementsByTagName("a")
                    aa = 1
                   
                    For rr = doc.getElementsByTagName("a").Length - 1 To 0 Step -1
                        If LCase(Right(doc.getElementsByTagName("a").Item(rr).href, 4)) = "xlsx" Then
'                            ws4.Cells(aa, 1) = internetinnerlink.href
doc.getElementsByTagName("a").Item(rr).Click
                            SendKeys "{TAB}"
                            SendKeys "{ENTER}"
                            'ie.navigate doc.getElementsByTagName("a").Item(rr).href
                            Application.Wait Now + TimeValue("00:00:05")
                            Call Busy

                            'SendKeys "%{O}"

                            Application.Wait Now + TimeValue("00:00:02")

                            Exit For
                            aa = aa + 1
                        End If
                    Next rr
 
Hi !

If you really need to use SendKeys,
activate Windows Script Host Object Model reference
then in your code :​
Code:
' declare object
    Dim oWSh As New WshShell
   
' use it like
    oWSh.SendKeys "{TAB}"
   
' before exit
    Set oWSh = Nothing
All I can do without webpage access …
 
Match when I am trying to place the code you have written in my script, and running the code, it is saying that USER DEFINED TYPE NOT DEFINED and highlighting the WshSHell...

What to do next... tell me sir.
 
Nothing more if first, as I yet wrote, you followed this direction :
Wow Marc.. it worked..

but when file is being downloaded from the link, it is taking time around 20-30 seconds but in mean time code skips and moves to the next statement and giving error.

Application.wait is not working

is there any way this can be sorted out?

Thanks
Regards
RatanB
 
Raise the time within the Wait function for example …

Or just observe what happens before, during and after download
to test if an object is available or not,
if a file exists or not, if it is locked or not, …

Find within webbrowser inner inspector tool if a request is used,
so in this case it is smarter to not pilot IE
but just to reproduce same request !
 
Raise the time within the Wait function for example …

Or just observe what happens before, during and after download
to test if an object is available or not,
if a file exists or not, if it is locked or not, …

Find within webbrowser inner inspector tool if a request is used,
so in this case it is smarter to not pilot IE
but just to reproduce same request !
Marc

I have tried loop which is starting from NOW to NOW + 50 Seconds and working perfectly.

But here another, I have stucked into another problem, which is when new file is opened, it is opened in new instance, and the further code which is referring to this new actvie workbook does not work as it is not in same instance.

so how to solve this problem?

Please advise.

Thanks and Rgeards
 
Hi Marc

I have got it worked wasily

Workbooks.open URL

thats it..

it is opening the workbook in the same instance and working like charm

Thanks for your great help man..

thanks ton
 
Back
Top