开发者

Getting return values from an embedded Internet explorer

I know how to open an Internet explorer from within an VBA application. But how to I get "return" values from the running explorer to the 开发者_如何转开发VBA application. E.g let us assume I try to access http://page_not_there and got back an Error 400

How can I get this value in my VBA Application and act accordingly. Any hints or links or programming examples would be very welcome

Of fine editing is possible. So the order is: Information is send, and i get back an HTML string which can be used from within IE to sign a document. Of course for that one has to click a bit around in IE but at the end I get a sort of "feedback" if signing was successfull and I need this "feedback" to know if I can proceed.

I've close my windows boxes so take his with some caution. I start IE like this

set ie = CreateObject("InternetExplorer.Application")
ie.navigate2 "to_where_I_want"

That's all.

I then get a page where a Java applet is running for signing the URL choosen above ("to_where_I_want") I have few buttons there and after hitting on signing I have to type in my PIN and then I'M interested in the output of the IE Explorer.

As I understand you post I better create a form with a Web control and use this for browsing and Signing

Regards Friedrich


Here are some notes on one way to get the status of a page.

   Dim http As Object
   Dim xmlhttp As Object

       Set http = CreateObject("MSXML2.ServerXMLHTTP.4.0")
       Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

       On Error Resume Next

       xmlhttp.Open "GET", url, False
       ''This alternative can return status 405 in some cases
       ''xmlhttp.Open "HEAD", url, False
       xmlhttp.Send ""

       ''You can get the status of the page
       Status = xmlhttp.Status

       If Err.Number <> 0 Or Status <> 200 Then
           IsLink = False
       Else
           IsLink = True
       End If

       Set xmlhttp = Nothing

EDIT: Some Notes re Comments

Assuming that there is a form called WBForm with a control called WB, which is a Microsoft Web Browser control:

 ''Navigate to a non-existent page 
 Forms!WBForm!WB.Navigate "http://lessthandot.com/somepage.htm"
 ''Title of the page
 MsgBox Forms!WBForm!WB.Document.Title

The title will contain "HTTP 404 Not Found" in the case above. The document can also be read using the various elements.

The document object model Scripting with Elements and Collections

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜