title: VBScript to import HTML into Excel and create chart
body: <p>As you can tell by the following code, I'm new to VBscripting for Excel. I'm simply trying to import an HTML file ("DEMO8.HTM") into Excel and create a chart based on the data in column F. The chart should show up as an object in the sheet created. I'm having a problem getting the 'Chart.Add' syntax to work. Whenever I change it, something else goes wrong. Anyway, here's the code: </p>
  
  <pre><code>Dim chtChart
  
  Set objExcel = CreateObject("Excel.Application")
  Set objWorkbook = objExcel.Workbooks.Open("C:\DEMO8.HTM")
  objExcel.Visible = TRUE
  
  Set chtChart = Charts.Add
  With chtChart
      chtChart.ChartType = xlColumnClustered
      chtChart.SetSourceData.Range("'DEMO8'!$F:$F")
      chtChart.Location.xlLocationAsObject
  
      ActiveChart.SetSourceData Source:=Range("'DEMO8'!$F:$F")
      ActiveChart.Legend.Select
      Selection.Delete
      ActiveChart.ChartArea.Select
      ActiveChart.Axes(xlCategory).Select
      Selection.Delete
      ActiveChart.ChartArea.Select
      ActiveChart.Axes(xlValue).Select
      ActiveChart.Axes(xlValue).MaximumScale = 300
      ActiveChart.Axes(xlValue).MinimumScale = 0
  End With
  
  ' Give the user control of Excel
  UserControl = true
  </code></pre>
  
  <p>I basically 'Frankensteined' this from various bits of code. It seems to open the HTML file but doesn't create the chart. Any help is appreciated. </p>