<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Meta name = "GENERATOR" content = "Microsoft FrontPage 5.0">
<Meta name = "ProgId" content = "FrontPage. Editor. Document">
<Title> generate a Word document </title>
</Head>
<Script language = "vbscript">
Sub builddoc ()
On Error Resume Next
Dim wApp
Set wApp = CreateObject ("Word. Application ")
If Err. number> 0 Then
Alert "cannot be saved as a Word file. Please install Word97 correctly"
Else
WApp. visible = True
WApp. Documents. add
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = True
WApp. Selection. TypeText "programfan"
WApp. Selection. ParagraphFormat. Alignment = 1
Rem housing
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
WApp. Selection. TypeText "-- programfan.com"
WApp. Selection. TypeParagraph
WApp. Selection. ParagraphFormat. LeftIndent = wApp. CentimetersToPoints (0)
WApp. Selection. ParagraphFormat. FirstLineIndent = wApp. CentimetersToPoints (0.72/2*2)
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
WApp. Selection. ParagraphFormat. Alignment = 0
Wapp. selection. typetext document.form1.doc 1. value
WApp. Selection. TypeParagraph
Rem right
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
WApp. Selection. TypeText Now ()
WApp. Selection. TypeParagraph
WApp. Saved = true
Wapp. ActiveDocument. SaveAs "c: \ a.doc"
Wapp. close
End if
End sub
</Script>
<Body>
<Form name = "form1">
<P> </p>
<P> <textarea rows = "8" name = "doc1" cols = "46"> </textarea> </p>
<P> </p>
<P> generate a Word document <input type = "button" value = "generate" name = "B1" onclick = "builddoc ()"> </p>
</Form>
</Body>
</Html>