Dim curPath
curPath = WScript.ScriptFullName
curPath = Left(curPath, InstrRev(curPath, ))
Dim word, doc, docName
Set word = CreateObject(Word.Application)
Set doc = word.Documents.Add(curPath & testinvoice.dot)
number = InputBox(Enter the invoice number)
if number =  then
 doc.Close
 word.Quit
end if
invdate = InputBox(Enter the invoice date)
if invdate =  then
 doc.Close
 word.Quit
end if
recip = InputBox(Enter the recipient)
if recip =  then
 doc.Close
 word.Quit
end if
? Начало метки A
doc.Bookmarks(InvoiceNumber).Range.Text = number
doc.Bookmarks(InvoiceDate).Range.Text = invdate
doc.Bookmarks(InvoiceRecipient).Range.Text = recip
? Конец метки A
? Начало метки B
docName = curPath & inv_ & number & .doc
doc.SaveAs docName
doc.SendMail
WScript.Sleep(2000)
doc.Close
word.Quit
? Конец метки B