How to use ASP & Word (Word.Application) - Create Word Document This is learn/tutorial asp developers how to using ASP script Create word document (.doc)
ShotDev Focus:
- ASP & Create word document (.doc)
Example
asp_create_word.asp
<% OptionĀ Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim Wrd,DocName Set Wrd = CreateObject("Word.Application") Wrd.Application.Visible = False Wrd.Documents.Add() DocName = "MyDoc/MyWord.doc" With Wrd .Selection.TypeText "Welcome To www.ShotDev.Com" End With Wrd.ActiveDocument.SaveAs(Server.MapPath(DocName)) Wrd.Application.Quit Set Wrd = Nothing %> Word Created <a href="<%=DocName%>">Click here</a> to Download. </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_create_word.asp
Screenshot