how to get url from table for ie object navigate property

alap43841

Registered User.
Local time
Tomorrow, 03:41
Joined
May 9, 2006
Messages
36
I am extracting data from web page that is used as table in a database. The address of the webpage changes frequently, I want to store the web address in a table and get the web address for the ie object from from the table.

Code:
 Dim colTables As Object
      Dim strDocHTML As String
      Set ieBrowser = CreateObject("internetexplorer.application")
    
    ieBrowser.Navigate [COLOR="Red"]"http://web.dse.com.bd/admin-real/latest_share_price_all.php"[/COLOR]
        While ieBrowser.Busy 'WAIT LIKE USUAL
    DoEvents
    Wend
      
      While ieBrowser.Document.All.tags("TABLE").Length > 1
         DoEvents
      Wend

Is it possible to get the url from a table so that I can change the web address in the table when ever it is changed,

ieBrowser.Navigate "http://web.dse.com.bd/admin-real/latest_share_price_all.php"

thanks
 
If the url changes frequently, how would storing the url in a table help?

You can certainly store a url in a table.
An you could use
ie.navigate TablefieldValue_here

But if the value in the table, now, doesn't match the intended location, what do you want to happen?
Perhaps I'm missing something - please advise.
 
Thanks for your reply, actually I am extracting data as delimited text file which used as liked table, Could you please be little more specific as to how to do this? I am not an expert on VBA, thanks
 
The address of the webpage changes frequently, I want to store the web address in a table and get the web address for the ie object from from the table.

There are lots of questions of exactly what you want to do.

First do you know all the possible URLs that could be used? Is there any other information on why they change etc.

If yes then what you need is a table with at least a string of all the possible URLs. Then you need to open this database, table with a SQL and get a recordset and then slowly loop through the URLs. You would need to give each URL to the IE and then wait for an event - I am not sure what that could be right now as it depends on what a non functioning URL responds as in your case. You might have to just set a timer. Then you move onto the second URL in the recordset.
 
darbid, thanks for your reply, the web page that I extract behaves funny many a time and address is changed without any notice, I then look for new address and change the ie navigate property manually. I want to have table with two fields "WebLink" and "LinkID". If the address is changed I want to change the webAddress in "webLink" field of the table, I tried using SQL with ie Navigate property but could not succeed.

I tried this way:
Code:
      Dim strSQL As String
      Dim colTables As Object
      Dim strDocHTML As String
      
      strSQL="SELECT [B]WebLink[/B] FROM [tblName] WHERE [B]LinkID[/B]=5;"

      Set ieBrowser = CreateObject("internetexplorer.application")
    
    ieBrowser.Navigate strSQL
        While ieBrowser.Busy 'WAIT LIKE USUAL
    DoEvents
    Wend
      
      While ieBrowser.Document.All.tags("TABLE").Length > 1
         DoEvents
      Wend

Another problem I am facing when the webpage creates problem returns unusual data, like right at this moment it is showing :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/admin-real/latest_share_price_all.php on line 20
# Trading Code LTP* High Low Close Price YCP Change Trade Volume
and data in my link table is lost, is it possible to suspend executing code for extracting data if the webpage does not return expected data? Sorry to put so many problems at a time, thanks anyway.......
 
Last edited:
How does the URL change. Is it changing with prediction or are they doing something really strange with the URL - totally changing it?

Can you give me some old URLs that did work but not now?

Re your new problem this looks like a webpage/database problem. I do not know how to fix this problem. What I would do is when this happens work out what error messages I can receive from IE and then deal with them.

I cannot tell you anything more about that part unless I can test some things out. So do you have a URL where you get this error.

How are you getting the table? I think you might need to show more code so I can test it. You could make a MDB which would mean I can actually change it and test it.
 
Thanks, I will do and provide you necessary DB as asked shortly................. :)
 
Earlier the the Address of the web-page was:
h t tp: //w w w .dse bd.org/ latest _share _price_all.php
Now it does not work, and changed to this one:
h t t p: // web.ds e.com.bd/admin -real/latest _share_price _all.php

Again it (h t tp: // web .dse.com.bd/admin-real/latest _share _price _all.php
) sometimes returns unusual data. If the link address is changed again, I want to change it in the table so that I don't have to modify VBA code every time.

Is it possible that until the web-page loads completely and returns all data (the last data should be "ZEAMBENGLA" on "Trading Code" column) the data extraction process should not start.
That test DB is attached here with..............There is a link table so please put the folder on C:\..........thanks again
 
Last edited:
Do you know why the URL changes?

Why is the URL pointing to a different directory in your second example, the domain stays the same but it now points at a new sub dir within the domain, seems a bit strange to me, I assume you are not the admin of the webserver

I guess what Im saying is you need to understand why the address changes before you can look at all the possible URLs that it could change to
 
Definitely there are problems with the site and i don't know what is that. I only I need to get data for my database to analyze my stocks. I got this alternative address from my friends. But my point is not that why the web address changes every time, I need to make it easy if the address is changed.
 
hey what is that test. I am sorry but I cannot get it to step through code. There is something special in there. Can you put a break on the code for the refresh and get the code to pause?
maybe it is something special but I cannot get it.
 
Sorry bro, I know nothing about coding, I got it from the web and using it with little modification or as it is..........
 

Users who are viewing this thread

Back
Top Bottom