Question : Getting return value from an embedded Internet explorer

I know how to steer an internet explorer with VBA. But I do not know how do I get return values from an external
internet explorer while browsing with it.

E.g assume I access
http://this_page_does_not_exist.
Then I get an 400 Error code in the IE, how can I make this accessible to my VBA program?

I'm sure it works somehow and I think it'll work with event sinks or the like. But I've no real clue about that.

Any links and hints would be very welcome

Regards
Friedrich

Answer : Getting return value from an embedded Internet explorer

fridom

my apologies, I didn't have enough time to reply to your last post.

Once you enter a url, then click on a link on that page, the url should change,
this is how you can check the url name:
assuming web.LocationURL is the IE control name of the url,
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_22086913.html
To check if the "new" url after the click is http://this_page_does_not_exist,
use this code:
if instr(web.LocationURL,"this_page_does_not_exist") > 0 then
 'the url has the words: this_page_does_not_exist
 'do what you need to do, when the url contains this_page_does_not_exist
endif


However, if this message was in the body of the url, then use the second code


these are the basics, and you will have to modify them slightly to suite your requirement.

jaffer
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
'url code:
 dim HowManyTimes as integer   
'wait until the browser goes to the Approval page
    HowManyTimes =0
StartAgain:
    If web.LocationURL = TempURL Then
        'pause 2 seconds
        PauseTime = 2    ' Set duration.
        Start = Timer    ' Set start time.
        Do While Timer < Start + PauseTime
            DoEvents    ' Yield to other processes.
        Loop
        'loop 5 times, which is 5 x 2 = 10 seconds 
        if HowManyTimes <5 then
          HowManyTimes =HowManyTimes +1
        else
          goto LoopedEnough
        endif
        GoTo StartAgain
    End If

LoopedEnough:
'continue your code here


'--------------------------
    vBody = IE.Document.body.innerHTML

    'find the 1st occurance of 'this_page_does_not_exist' 
if InStr(vBody, "this_page_does_not_exist")> 0 then
 'the page Body has the words: this_page_does_not_exist
 'do what you need to do, when the page contains this_page_does_not_exist
endif
    
Random Solutions  
 
programming4us programming4us