1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Dim sAutoquePath, sTemplateFile
Dim oMain, wdocs, wdoc, wdo
sAutoquePath = "c:\testfax\"
sTemplateFile = "document.doc"
' Open the Template document
Set wdo = CreateObject("Word.Application")
If wdo Is Nothing Then
WScript.Echo "Error: Cannot create Word document. MS Word " + "MS Word is not available! Quiting..."
WScript.Quit 2
End If
Set wdocs = wdo.Documents
Set wdoc = wdocs.Open(sAutoquePath & sTemplateFile)
'get the last record of datasource
Set oMain = wdo.ActiveDocument
wdo.ActiveDocument = oMain
wdo.Quit WdDoNotSaveChanges
Set wdo = Nothing |