VB中如何将text导入word并保存,要简单代码
展开全部
-----------------------------------------------------------------------------新建文档
Private Sub Command1_Click()
Dim App As Object
Set App = CreateObject("word.application") '创建word对象
With App.documents.Add '添加一个空白文档
.Content.InsertAfter Text1.Text '在文档后面插入text1的内容
.saveas "d:\123.doc" '保存
.Close True '关闭 文档
App.quit '退出word程序
End With
End Sub
----------------------------------------------------------------------------打开以有文档
Private Sub Command1_Click()
Dim App As Object
Set App = CreateObject("word.application") '创建word对象
With App.documents.open("d:\123.doc") '打开文档
.Content.InsertAfter Text1.Text '在文档后面插入text1的内容
.save '保存
.Close True '关闭 文档
App.quit '退出word程序
End With
End Sub
Private Sub Command1_Click()
Dim App As Object
Set App = CreateObject("word.application") '创建word对象
With App.documents.Add '添加一个空白文档
.Content.InsertAfter Text1.Text '在文档后面插入text1的内容
.saveas "d:\123.doc" '保存
.Close True '关闭 文档
App.quit '退出word程序
End With
End Sub
----------------------------------------------------------------------------打开以有文档
Private Sub Command1_Click()
Dim App As Object
Set App = CreateObject("word.application") '创建word对象
With App.documents.open("d:\123.doc") '打开文档
.Content.InsertAfter Text1.Text '在文档后面插入text1的内容
.save '保存
.Close True '关闭 文档
App.quit '退出word程序
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询