请教各位大神们,如何将excel中的数据用MSHFlexGrid1控件来显示?
先将我瞎编的奉上,我编的这个能打开excel却不能显示在MSHFlexGrid1表格中,各位大神,帮我看看?Private Sub Command1_Click()
On Error Resume Next
Dim fileadd As String
CommonDialog1.ShowOpen
CommonDialog1.Filter = "xls文件(*.xls)|*.xls"
fileadd = CommonDialog1.FileName
MSHFlexGrid1.Redraw = False
Set xlApp = CreateObject("excel.Application")
Set xlBook = xlApp.Workbooks.Open(fileadd)
xlApp.Visible = True
Set xlsheet = xlBook.Worksheets("Sheet1")
For R = 0 To MSHFlexGrid1.Rows - 1
For C = 0 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Row = R
MSHFlexGrid1.Col = C
Next C
Next R
MSHFlexGrid1.Redraw = True
xlApp.DisplayAlerts = False
End Sub