读书人

利用WORD模版怎么快速批量生成WORD文

发布时间: 2013-11-05 14:40:42 作者: rapoo

利用WORD模版,如何快速批量生成WORD文档
本帖最后由 bcrun 于 2013-10-21 10:59:01 编辑 作了个程序测试,发现错误提示5941
集合所要求的成员不存在
请老师帮忙看看

Private Sub Command1_Click()
Dim i As Long
Dim Report As Word.Document
Dim ApplicationWd As Word.Application
Set ApplicationWd = New Word.Application
' Set Report = ApplicationWd.Documents.Add(App.Path & "\text.doc")

For i = 1 To 50
SaveWord i, Report
Next i

Set Report = Nothing
ApplicationWd.Quit

End Sub

Private Function SaveWord(ByVal i As Long, ByVal TmpReport As Word.Document)

Dim Myrange As Range
Set Myrange = TmpReport.FormFields.Item("aaa").Range
Myrange.Text = Text1.Text

TmpReport.SaveAs (App.Path & "\" & i & ".doc")

Set TmpReport = Nothing
Set Myrange = Nothing
End Function

[解决办法]
邮件合并功能。
[解决办法]
Web程序还是WinForm程序,网上找找有没有第三方的产品可以实现

读书人网 >VB

热点推荐