Private Sub Command1_Click()
Dim adoCnn As New ADODB.Connection
Dim adoRst As New ADODB.Recordset
adoCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & filepath & ";Extended Properties='Excel 8.0;HDR=Yes'"
adoRst.Open "Select time,tt From [sheet1$] ", adoCnn, adOpenKeyset, adLockOptimistic ‘sql查询语句,time,tt代表数据的列,想要几列数据就加几个,
'Set Me.MSHFlexGrid1.DataSource = adoRst '数据显示在MSHFlexGrid中
'图标绑定数据源 绑定到excel的数据中
With MSChart1
.ShowLegend = True
Set .DataSource = adoRst
.ChartType = VtChChartType2dLine