run time error

klatlap

Well-known Member
Joined
Sep 1, 2004
Messages
607
Office Version
  1. 2013
Platform
  1. Windows
trying to learn something new, am follow some stuff on your tube but getting a run time error 13, not sure what.

Code:
Sub BrowseToSite()
    Dim IE As New SHDocVw.InternetExplorer
    Dim HTMLDoc As MSHTML.HTMLDocument
    Dim HTMLInput As MSHTML.IHTMLElement
    Dim HTMLAs As MSHTML.HTMLElementCollection
    Dim HTMLA As MSHTML.IHTMLElement
    
    IE.Visible = True
    IE.Navigate "x-rates.com"
    Do While IE.ReadyState <> READYSTATE_COMPLETE
    Loop
    
    Set HTMLDoc = IE.Document
    
    Set HTMLInput = HTMLDoc.getElementById("amount")
    HTMLInput.Value = 5
    
    Set HTMLInput = HTMLDoc.getElementById("from")
    HTMLInput.Value = "GBP"
    
    Set HTMLInput = HTMLDoc.getElementById("to")
    HTMLInput.Value = "USD"
    
    Set HTMLAs = HTMLDoc.getElementsByTagName("A")
    
    For Each HTMLA In HTMLAs
    Debug.Print HTMLA.getAttribute("classname"), HTMLA.getAttribute("href"), HTMLA.getAttribute("rel")
    Next HTMLA
    
    
    End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try deldaring HTMLAs as follows...

Code:
Dim HTMLAs As MSHTML.IHTMLElementCollection

Hope this helps!
 
Upvote 0
oh now i see, i am missing an "I" , thank you, cheers.
 
Upvote 0

Forum statistics

Threads
1,214,393
Messages
6,119,261
Members
448,880
Latest member
aveternik

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