ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-time error 1004. Application-defined or object-defined error (https://www.excelbanter.com/excel-programming/390867-run-time-error-1004-application-defined-object-defined-error.html)

Martin Brennan

Run-time error 1004. Application-defined or object-defined error
 
The code for this procedure was originally written in Excel 2000 on a
machine using Windows 2000, I am in the process of moving this and others to
a machine using Windows XP Home and Excel 2000.

I get the above error with the third line of the following code. This has
previously run successfully.

Marke****chRng.Offset(0, 3).Value = Marke****chPos2Str

Marke****chRng.Offset(0, 4).Value = Marke****chPos4Str

Marke****chRng.Offset(0, 5).Value = Marke****chPos5Str
'*** Error occurs at this line***


Debug.Print Marke****chRng.Offset(0, 3).Address
Debug.Print Marke****chPos2Str
Debug.Print Marke****chRng.Offset(0, 4).Address
Debug.Print Marke****chPos4Str
Debug.Print Marke****chRng.Offset(0, 5).Address
Debug.Print Marke****chPos5Str

produces the following in the Immediate window.

$D$7055
10:26am

$E$7055
at=",2" mwfield="Price"6,550.20</SPAN</SPAN<IMG
$F$7055
="UK:1805550" mwformat=",2" mwfield="Price"6,550.20</S

I don't know where to start to look to eliminate the error. Any suggestions
greatly appreciated.

Thanks
Martin



Bob Phillips

Run-time error 1004. Application-defined or object-defined error
 
Looks like you have mis-matched quotes. What code populates
Marke****chPos5Str ?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Martin Brennan" wrote in message
...
The code for this procedure was originally written in Excel 2000 on a
machine using Windows 2000, I am in the process of moving this and others
to a machine using Windows XP Home and Excel 2000.

I get the above error with the third line of the following code. This has
previously run successfully.

Marke****chRng.Offset(0, 3).Value = Marke****chPos2Str

Marke****chRng.Offset(0, 4).Value = Marke****chPos4Str

Marke****chRng.Offset(0, 5).Value = Marke****chPos5Str
'*** Error occurs at this line***


Debug.Print Marke****chRng.Offset(0, 3).Address
Debug.Print Marke****chPos2Str
Debug.Print Marke****chRng.Offset(0, 4).Address
Debug.Print Marke****chPos4Str
Debug.Print Marke****chRng.Offset(0, 5).Address
Debug.Print Marke****chPos5Str

produces the following in the Immediate window.

$D$7055
10:26am

$E$7055
at=",2" mwfield="Price"6,550.20</SPAN</SPAN<IMG
$F$7055
="UK:1805550" mwformat=",2" mwfield="Price"6,550.20</S

I don't know where to start to look to eliminate the error. Any
suggestions greatly appreciated.

Thanks
Martin




Martin Brennan[_2_]

Run-time error 1004. Application-defined or object-defined error
 
Bob,
Thanks for the swift reply, I've posted the code below and marked the
relevant lines with asterisks. Any help is appreciated.
Martin

Set Marke****chRng = AIE1_01.Range("a65536").End(xlUp).Offset(1, 0)

Marke****chUrlStr =
"http://www.marke****ch.com/quotes/uk/ftse100?sid=123797"

Marke****chSrcStr = "Marke****ch"

Marke****chString1 = "QuoteTime1"

Marke****chString2 = "BigPriceClass"

Marke****chTimeout = Now
IE_1.Navigate Marke****chUrlStr

Do Until Not IE_1.busy Or ( _
Now - Marke****chTimeout) TimeValue("00:00:10"): DoEvents: Loop

Do Until IE_1.readystate = 4 Or ( _
Now - Marke****chTimeout) TimeValue("00:00:15"): DoEvents:
Loop

If IE_1.readystate = 4 Then
If InStr(IE_1.document.body.innerhtml, _
Marke****chString1) < 0 Then


Marke****chPos1Lng = InStr(IE_1.document.body.innerhtml,
_
Marke****chString1)

Marke****chPos2Str = Mid(IE_1.document.body.innerhtml, _
Marke****chPos1Lng + 108, 8)
'*** Get Marke****chPos3Lng ***

Marke****chPos3Lng = InStr(IE_1.document.body.innerhtml,
_
Marke****chString2)

Marke****chPos4Str = Mid(IE_1.document.body.innerhtml, _
Marke****chPos3Lng + 120,
50)

'*** Use Marke****chPos3Lng to get Marke****chPos5Str ***

Marke****chPos5Str = Mid(IE_1.document.body.innerhtml, _
Marke****chPos3Lng + 100,
55)


Marke****chRng.Offset(0, 3).Value = Marke****chPos2Str

Marke****chRng.Offset(0, 4).Value = Marke****chPos4Str

Marke****chRng.Offset(0, 5).Value = Marke****chPos5Str

Debug.Print Marke****chRng.Offset(0, 3).Address
Debug.Print Marke****chPos2Str
Debug.Print Marke****chRng.Offset(0, 4).Address
Debug.Print Marke****chPos4Str
Debug.Print Marke****chRng.Offset(0, 5).Address
Debug.Print Marke****chPos5Str


"Bob Phillips" wrote in message
...
Looks like you have mis-matched quotes. What code populates
Marke****chPos5Str ?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Martin Brennan" wrote in message
...
The code for this procedure was originally written in Excel 2000 on a
machine using Windows 2000, I am in the process of moving this and others
to a machine using Windows XP Home and Excel 2000.

I get the above error with the third line of the following code. This has
previously run successfully.

Marke****chRng.Offset(0, 3).Value = Marke****chPos2Str

Marke****chRng.Offset(0, 4).Value = Marke****chPos4Str

Marke****chRng.Offset(0, 5).Value = Marke****chPos5Str
'*** Error occurs at this line***


Debug.Print Marke****chRng.Offset(0, 3).Address
Debug.Print Marke****chPos2Str
Debug.Print Marke****chRng.Offset(0, 4).Address
Debug.Print Marke****chPos4Str
Debug.Print Marke****chRng.Offset(0, 5).Address
Debug.Print Marke****chPos5Str

produces the following in the Immediate window.

$D$7055
10:26am

$E$7055
at=",2" mwfield="Price"6,550.20</SPAN</SPAN<IMG
$F$7055
="UK:1805550" mwformat=",2" mwfield="Price"6,550.20</S

I don't know where to start to look to eliminate the error. Any
suggestions greatly appreciated.

Thanks
Martin







All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com