I am a geologist working for a small oil company in Louisiana. I constitute our tech department, and unfortunately my experience with coding is quite limited. I have used very basic vba coding in the past, but I dont code that much in my daily job, so I have forgotten most of it.

The louisiana dnr keeps amazing records for every single oil well drilled in the state and all of these records are located at www.Sonris.com. Part of these records are the production records for each well. I would like to create a macro that follows a given url and downloads the table found on the URL (aka the production records). After it downloads the file, I would like it to put the table in a new sheet and then to name this sheet based on the well name. 

I have fooled around with the retrieve data from web function, however I cannot make the function dynamic enough. I need the code to copy the hyperlink data found in a cell. Currently, the code just follows the hyperlink that I copy and paste while recording the macro. 

Any help would be appreciated

Sincerely,
Josiah

Below is the code generated;

    Sub Macro2()
'
'     Macro2 Macro
' attempt with multiple well to look at code instead of 1 well
'

'
    Range("E27").Select
    ActiveWorkbook.Worksheets.Add
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_wellinfo2?p_WSN=159392" _
        , Destination:=Range("$A$1"))
        .Name = "cart_con_wellinfo2?p_WSN=159392"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "1,11"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
    Sheets("Sheet1").Select
End Sub



Question: Running a get link serverside, with php
Answer: You can use cURL to call your link.
http://php.net/manual/ru/book.curl.php