Taking Data (VBa) From A Wen Page (1 Viewer)

CharlesWhiteman

Registered User.
Local time
Today, 14:35
Joined
Feb 26, 2007
Messages
421
Hi All, I am successfully using some code to open a web page and log in for me.

Code:
Dim ieApp As InternetExplorer
Set ieApp = New InternetExplorer
ieApp.visible = True
ieApp.Navigate "https://" & Me.txtIPAddress & "/login.cgi"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
With ieDoc.Forms(0)
         .UserName.Value = "xxx"
         .Password.Value = "yyy"
         .submit
     End With
     Do While ieApp.Busy: DoEvents: Loop
     Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

The bit I am really stuck on and still after reading various posts and googling I cannot seem to get a bit of code to read a value from the web page.

The (sample) source of the webpage looks like:

<table border="0" cellpadding="0" cellspacing="0" class="linktable">
<tr><th colspan="2">Status</th></tr>
<tr><td valign="top" style="width: 50%">
<div class="fieldset" id="general_info">
<div id="hostinfo" class="row">
<span class="label">Device Name:</span>
<span class="value" id="hostname"> </span>
</div>
<div id="netmodeinfo" class="row">
<span class="label">Network Mode:</span>
<span class="value" id="netmode"> </span>
</div>
<div id="wmodeinfo" class="row">
<span class="label">Wireless Mode:</span>
<span class="value" id="wmode"> </span>
</div>
<div id="astatusinfo" class="row">
<span class="label">airView Status:</span>
<span class="value" id="astatus"> </span>
</div>
<div id="ssidinfo" class="row">
<span class="label" id="essid_label">SSID:</span>
<span class="value" id="essid"> </span>
</div>

The code I found (http://www.access-programmers.co.uk/forums/showthread.php?t=176968)

showed me that the syntax to read a value is:
Code:
ie.Document.getElementById("ssidinfo").Value

But I get a runtime error 438 object or method not supported

Any advice for this particularly tough to crack much appreciated.
 

pr2-eugin

Super Moderator
Local time
Today, 14:35
Joined
Nov 30, 2011
Messages
8,494
Charles, if I am reading the HTML code right, the ID ssidinfo belongs to DIV tag not an INPUT tag. Which is what it means DIV tag does not support the value method..
 

CharlesWhiteman

Registered User.
Local time
Today, 14:35
Joined
Feb 26, 2007
Messages
421
Thanks Paul, Does this mean I will not be able to obtain the data by any method or do I need to use another method? Thanks.
 

pr2-eugin

Super Moderator
Local time
Today, 14:35
Joined
Nov 30, 2011
Messages
8,494
The method ajtrumpet proposed is to collect information from Form fields in a HTML page.. If you need to get random values from a specific tags you need to change your approach a bit different.. I think it would be WinHttpRequest..
 

Mihail

Registered User.
Local time
Today, 16:35
Joined
Jan 22, 2011
Messages
2,373
I'm not sure what you are looking for because I don't understand the full English.

However I think that the database from attachment can be a help for you.
I've tweaked it a little bit to be (near :) ) in English.
I use it in order to extract the exchange rate from a national site (a Romanian one).

Hope will be a help for you.

Good luck !
 

Attachments

  • WebScrapping_ExchangeRate.accdb
    1.1 MB · Views: 145

Users who are viewing this thread

Top Bottom