Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve the address bar URL from Excel

Status
Not open for further replies.

sandoztek

Programmer
Aug 20, 2008
27
FR
Hi,
How can I retrieve the URL of the current Firefox or IE browser address bar, using Excel vba code?

Also, when I try to retrieve the Microsoft Web control from Excel I get something like
"Impossible to insert an object"
What 's wrong?
 




Please post your code.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
My code is not yet written, only a part of it.
What I want to do is this :
Go to the RacingPost site and retrieve into an Excel sheet for further parsing some specific data(tables) about each race of the day.
the code is grossly as follows:
For i = 0 To n
PremCell = (i * 8) + 1
CardNb = 463358 + i '
Range("A" & PremCell).Select

With ActiveSheet.QueryTables.Add(Connection:= _
"URL; _
, Destination:=Range("A1"))
.Name = "card.sd?r_date=2008-8-18&race_id=46358&card_choice=card_4"
.FieldNames = True
.RowNumbers = True
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "10,12,17"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

Next

Practically it will go like this:
I go to the RacingPost site, log in, and look for the first race of the day, which displays sth like this:

I want to retrieve this URL, because it gives me directly the identification of the 1st race, that I will increment (in the CardNb variable)till the last one, which lets me extract the 3 quoted tables for all the races of the day.
 
So, nobody knows how to retrieve from Excel vba the URL of the current Firefox or IE browser address bar ?
 



Best I know is navigate thru the QueryTable connection.

Parse the Connection string to find the value to incriment.

No need to ADD a QueryTable once on is added to the sheet. Just edit the Connextion string.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
navigate thru the QueryTable connection" ?
It supposes an (already done)connection, right?
but precisely, to have this connection, I need an URL and it is located in the address bar of the IE/Firefox browser window.
How to retrieve it first?

Otherwise would you mind specifying what you mean with a few lines of code?
 





"It supposes an (already done)connection, right?"

You had to get there somehow. YES?

Get there thru the Web Query, only EDIT your existing query, and navigate the SAME WAY you did to generate the above posted code.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top