请教各位高人:
我建立了一个msflexgrid表格,怎样将其中的所有数据都储存在新的数据库中呢?没有思路啊
哪位大侠可以慷慨解难呢?
谢谢谢谢,小女子有礼了
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim ex As Object
Dim exwbook As Object
Dim exsheet As Object
Set ex = CreateObject("Excel.Application")
Set exwbook = ex.Workbooks().Add
Set exsheet = exwbook.Worksheets("sheet1")
'********************************
'MsgBox (exwbook.Name)
For i = 1 To 7
For j = 1 To 5
MSFlexGrid1.Row = i
MSFlexGrid1.Col = j
o$ = MSFlexGrid1.Text
Set act = exsheet.Cells(i, j)
'exsheet.Cells(i, j).Select
act.Value2 = o$
Next j
Next i
exwbook.SaveAs "c:\123.xls"
Set exwbook = Nothing
Set exsheet = Nothing
ex.Quit
MsgBox ("You can open the file C:\123.xls to see what happen!")
End
End Sub
Private Sub Form_Activate()
MSFlexGrid1.Rows = 8
MSFlexGrid1.Cols = 6
For i = 1 To 7
For j = 1 To 5
MSFlexGrid1.Row = i
MSFlexGrid1.Col = j
a$ = "(" + Str(i) + "," + Str(j) + ")"
MSFlexGrid1.Text = a$
Next j
Next i
End Sub