title: Importing a webpage to an Excel spreadsheet using VBA
body: <p>I wish to be able to download information from a website to an Excel spreadsheet, which is in <a href="http://share.com/data.aspx?year=2011&amp;month=5&amp;day=18&amp;table=Ford" rel="nofollow">this format – not the actual website</a>.</p>
  
  <p>I can do a web query with a macro, which works for a particular date and company as above. However, I want to be able - via an input statement - download any date in the web address. I would like the macro to prompt the user to enter the Year, Month and Day and particular Company, in order to download the relevant data.</p>
  
  <p>I do not know how to write code for ANY date &amp; company into the website address above as my attempts do not work!</p>
  
  <hr>
  
  <p>Hopefully this will help. It was taken from a horse racing form website which requires a date!</p>
  
  <p>This was my attempt at code to put a date, but it has bugs!</p>
  
  <pre><code>RaceDate = InputBox("Please enter today's date (YYYY/MM/DD)", "Enter Date")
  Meeting = InputBox("Enter Location of Race", "Enter Meeting")
  Race = InputBox("Enter Race  Number", "Enter Race")
  Range("A13").Select
  With ActiveSheet.QueryTables.Add(Connection:= "URL;http://tatts.com/racing/formguide.aspx? RaceDate &amp; Meeting &amp; Race"
    , Destination:=Range("$A$13"))
    .Name = "formguide.aspx? RaceDate &amp; Meeting &amp; Race"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .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
  </code></pre>
  
  <p>I know that these two lines will work for a specific date, but I need to adjust for a user inputted date!</p>
  
  <pre><code>"URL;http://tatts.com/racing/formguide.aspx?year=2012&amp;month=1&amp;day=20&amp;meeting=QR&amp;race=5" _
          , Destination:=Range("$A$13"))
          .Name = "formguide.aspx?year=2012&amp;month=1&amp;day=20&amp;meeting=QR&amp;race=5"
  </code></pre>