以下是引用foreach在2021-12-24 08:26:19的发言:
可以提供代码吗?
实在不知道怎么写入,谢谢
直接在EXCEL测试(已安装VFP)

程序代码:
Private Sub CommandButton1_Click()
Dim oFox As Object
Set oFox = CreateObject("VisualFoxPro.Application")
oFox.DoCmd "CREATE TABLE C:\temp\test.dbf (f1 I,f2 I,f3 I)"
oFox.DoCmd "INSERT INTO test VALUES (11,12,13)"
oFox.DoCmd "INSERT INTO test VALUES (21,22,23)"
oFox.DoCmd "GO TOP IN 'test'"
oFox.DataToClip "test", , 3
Cells(1, 1).Select
ActiveSheet.Paste
oFox.DoCmd "INSERT INTO test VALUES (" & Cells(2, 1).Value & "," & Cells(2, 2).Value & "," & Cells(2, 3).Value & ")"
oFox.DoCmd "INSERT INTO test VALUES (" & Cells(3, 1).Value & "," & Cells(3, 2).Value & "," & Cells(3, 3).Value & ")"
oFox.DoCmd "GO TOP IN 'test'"
oFox.DataToClip "test", , 3
Cells(5, 1).Select
ActiveSheet.Paste
oFox.DoCmd "USE IN 'test'"
End Sub