图片地址http://www.ylmf.net/read.php?tid=1202717
这个是写好的一个VB程序
如何用VB生成一个WORD文档啊
VB中如何生成一个WORD文档(有图)
答案:2 悬赏:10 手机版
解决时间 2021-02-10 06:52
- 提问者网友:活着好累
- 2021-02-09 12:59
最佳答案
- 五星知识达人网友:鱼忧
- 2021-02-09 13:08
Imports Word
‘打开
Dim mWordapp As Word.Application ‘word 应用程序
Dim mobjDoc As Word.Document ’word 文档
Dim fullFileName as string ‘文件路径
mWordapp = CreateObject(”Word.Application”)
mobjDoc = mWordapp.Documents.Add(FullFileName)
‘关闭
Dim missing As Object = System.Reflection.Missing.Value
mWordapp.Application.Quit()
If Not mobjDoc Is Nothing Then
‘垃圾回收
System.Runtime.InteropServices.Marshal.ReleaseComObject(mobjDoc)
mobjDoc = Nothing
End If
If Not mWordapp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(mWordapp)
mWordapp = Nothing
End If
‘真正释放word进程
GC.Collect()
学习更多教程,请浏览: VB.NET入门教程 雄网
‘打开
Dim mWordapp As Word.Application ‘word 应用程序
Dim mobjDoc As Word.Document ’word 文档
Dim fullFileName as string ‘文件路径
mWordapp = CreateObject(”Word.Application”)
mobjDoc = mWordapp.Documents.Add(FullFileName)
‘关闭
Dim missing As Object = System.Reflection.Missing.Value
mWordapp.Application.Quit()
If Not mobjDoc Is Nothing Then
‘垃圾回收
System.Runtime.InteropServices.Marshal.ReleaseComObject(mobjDoc)
mobjDoc = Nothing
End If
If Not mWordapp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(mWordapp)
mWordapp = Nothing
End If
‘真正释放word进程
GC.Collect()
学习更多教程,请浏览: VB.NET入门教程 雄网
全部回答
- 1楼网友:忘川信使
- 2021-02-09 13:34
dim wordapp as new word.application
dim mydoc as word.document
wordapp.documents.add()
mydoc = wordapp.activedocument
wordapp.visible = true
命名空间
interop.word
interop.microsoft.office.core
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯