inporting data from website where website address frequently chang

H

HP

Hello, thanks in advance for your help.

I need to finish a macro that opens "get external data"/"import data"/ and
then places the website typed into the 'myinput' field into the field box.



The website has different pages for the same type data.

http://www.website.org/app.php?page=businesses&action=about&id=99999

I know it's something regarding that "FINDER: @@@" statement.

Here's where i'm at:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/21/2007 by me
'
Dim Website
Website = InputBox("Enter the Address of the site")

'
Range("C117").Select
ActiveWindow.SmallScroll Down:=-3
ActiveWindow.LargeScroll Down:=-3
Range("A1").Select
Sheets("Sheet2").Select
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _

"FINDER;http://www.website.org/app.php?page=businesses&action=about&id=99999", _
Destination:=Range("A1"))
.Name = "app.php?page=businesses&action=about&id=99999"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
 
D

Don Guillett

IF??? you are trying to change the url, use a variable

Sub GetUrl()
Website = InputBox("Enter the Address of the site")
'assuming answer is 99999 you would get
'http://www.website.org/app.php?page=businesses&action=about&id=99999

murl="http://www.website.org/app.php?page=businesses&action=about&id="&
website
ActiveWorkbook.Worksheets.Add
With ActiveSheet..QueryTables.Add( _
Connection:="URL;" & myurl, Destination:=.Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
end sub

If not, you may change url strings
"http://www.website"&xxxxxxxxxx&"bbbbbbbb"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top