我用的是如下代码,在读取了一条记录后,再读取下一条记录时,会提示“写入文件失败”: Private Sub tk_ReadFile() Set tm_Stm = New ADODB.Stream With tm_Stm .Mode = adModeReadWrite .Type = adTypeBinary .Open .Write Rs("题目") .SaveToFile App.Path & "\tm.doc" End With With OLE1 .SourceDoc = App.Path & "\tm.doc" .Action = 1 '从文件的内容中创建链接对象 End With End Sub
哎,再帮你一下吧,本不想再说什么。Private Sub tk_ReadFile() static i as long Set tm_Stm = New ADODB.Stream With tm_Stm .Mode = adModeReadWrite .Type = adTypeBinary .Open .Write Rs("题目") .SaveToFile App.Path & "\tm" & cstr(i) & ".doc" End With With OLE1 .SourceDoc = App.Path & "\tm" & cstr(i) & ".doc" .Action = 1 '从文件的内容中创建链接对象 End With i=i+1 End Sub private sub form_load() kill App.Path & "\tm*.doc" end sub
Private Sub tk_ReadFile()
Set tm_Stm = New ADODB.Stream
With tm_Stm
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Write Rs("题目")
.SaveToFile App.Path & "\tm.doc"
End With
With OLE1
.SourceDoc = App.Path & "\tm.doc"
.Action = 1 '从文件的内容中创建链接对象
End With
End Sub
Kill App.Path & "\题目.doc"
static i as long
Set tm_Stm = New ADODB.Stream
With tm_Stm
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Write Rs("题目")
.SaveToFile App.Path & "\tm" & cstr(i) & ".doc"
End With
With OLE1
.SourceDoc = App.Path & "\tm" & cstr(i) & ".doc"
.Action = 1 '从文件的内容中创建链接对象
End With
i=i+1
End Sub private sub form_load()
kill App.Path & "\tm*.doc"
end sub