Oliver Dewar
Board Regular
- Joined
- Apr 17, 2011
- Messages
- 201
Hi Guys.
I have two computers at home. One is my every day workhorse. One is for 'automation' tasks.
I have a macro I've written which opens internet explorer to a url then brings the innerhtml content into a sheet separated by < so that I may process each tag.
On my workhorse PC everything works perfectly but on my automation PC, the exact same workbook bugs out. Both run office 2007 and windows 7.
Here's the guts of the code I'm using without the specific website involved for privacy.
The error on the automation PC always occurs on the 'Cells(a + 1, 1).Value = x(a)' line and the error message reads:
"Run-time error '1004':
Application-defined or object-defined error"
I should note that internet explorer opens and navigates fine before this error is encountered and also that the files are the same file exactly on both computers as they are in cloud storage.
Any ideas what's going wrong here?
I have two computers at home. One is my every day workhorse. One is for 'automation' tasks.
I have a macro I've written which opens internet explorer to a url then brings the innerhtml content into a sheet separated by < so that I may process each tag.
On my workhorse PC everything works perfectly but on my automation PC, the exact same workbook bugs out. Both run office 2007 and windows 7.
Here's the guts of the code I'm using without the specific website involved for privacy.
Code:
Dim IE As Object
Dim x As Variant
Dim a As Integer
With IE
.Visible = True
.Navigate "http://example.com"
Do Until .readyState = 4: DoEvents: Loop
End With
With IE
x = Split(.document.body.innerhtml, "<")
For a = 0 To UBound(x)
Cells(a + 1, 1).Value = x(a)
Next a
End With
The error on the automation PC always occurs on the 'Cells(a + 1, 1).Value = x(a)' line and the error message reads:
"Run-time error '1004':
Application-defined or object-defined error"
I should note that internet explorer opens and navigates fine before this error is encountered and also that the files are the same file exactly on both computers as they are in cloud storage.
Any ideas what's going wrong here?