macro error 13: Type Mismatch

erin00

New Member
Joined
Jul 14, 2015
Messages
14
I have a macro to gather all text in a website (saw the code from other website). It works on my machine but does not work on others. The runtime error is 13, type mismatch.

I referenced:
Microsoft HTML Object Library
Microsoft Internet Controls
Microsoft Scripting Runtime
Microsoft Forms 2.0 Object Library

VBA Code:
Sub get_temperature()


Sheets("workspace").Select
Set IE = CreateObject("InternetExplorer.Application")
With IE
 .Visible = False
 .navigate "https://www.accuweather.com/en/us/boulder-co/80302/March-weather/327347" ' should work for any URL
Do Until .READYSTATE = 4: DoEvents: Loop

 gettemps = .document.body.innerText
 gettemps = Replace(gettemps, Chr(10), Chr(13))
 gettemps = Split(gettemps, Chr(13))
Worksheets("workspace").Range("A1").Resize(UBound(gettemps)) = Application.Transpose(gettemps)

 .Quit
 End With


End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
get them to check that these references are not missing
 
Upvote 0
You should probably include some error trapping code to make sure the webpage opened correctly

for example, if it didn’t, your Split command might produce a string rather than an array, and a string has no ubound property
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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