Writing to a Word document from an ASP page

How do I open a Word document and write to it from an ASP page using VB Script?
Who is Participating?
mayhewConnect With a Mentor Commented:
I wrote this in VB but it should be all good in asp.

I'm not positive that you need the app.quit at the end, though.

I'll test this tonight and let you know if I have any trouble.

Or if you play with, let me know if you have any success with it.

Hope this helps.

    'Create Word object.
    Set app = CreateObject("Word.Application")
    'Open new document.
    'Open an existing document.
    app.Documents.Open "d:\don\test.doc"
    'If multiple documents open, activate the one you want.
    'Type text.
    Selection.TypeText Text:="I love to program computers."
    'Save new document.
    app.ActiveDocument.SaveAs "d:\don\new.doc"
    'Close that document.
    'And save it.
    'And close document.
    'Close the app.
    Set app = Nothing

AllyCatAuthor Commented:
Adjusted points to 200
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.