Create and write to a word file

Results 1 to 2 of 2

Thread: Create and write to a word file

  1. #1
    Lixin Guest

    Default Create and write to a word file

    I want to create a word file and then wirte some content into it and then save in to a specific folder. I tried the following code:(name, date1, content variables are taken from a form)<BR>Dim wObj<BR>Set wObj = CreateObject("Word.Application")<BR>wObj.Documents .Add<BR> wObj.Selection.TypeText "Weekly Report"<BR> wObj.Selection.TypeText "Name:" & name<BR> wObj.Selection.TypeText "Date:" & date1<BR> wObj.Selection.TypeText "Contents:" <BR><BR> wObj.Selection.TypeText content<BR> wObj.ActiveDocument.SaveAs mypath<BR>&#039; tf.Close<BR> wObj.Quit<BR> &#039; Clear the variable from memory.<BR> Set wObj = Nothing<BR><BR>But I can not find the doc file after I run the script.(I get no error). Anybody know what is wrong? or how to do it? Thanks a lot!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Create and write to a word file

    Perhaps check out the following:<BR><BR>Sending Data to Microsoft Word - 10/3/2000<BR><BR>If you want to send your Web page content to a Microsoft Word file, you can use a different content type value. Here&#039;s the ContentType change you should use: <BR> Response.ContentType = "application/msword" <BR>This will cause your Web page&#039;s output to be read by Microsoft Word. You may get a dialog box asking you to open or save the ASP page. Even though the extension is .asp on the file you&#039;re prompted to save, it will open correctly in Word.<BR>JPS: But if you have a table inside a table you may get a Word error saying there were nested tables and was thus too complex to show as doc.<BR><BR>Build an Easy Maintenance Intranet Site: Using Office Docs, File System Object, and OLE Structured Storage by Josef Finsel <BR><BR>Assumes that a directory can be allowed access to only the human resources dept.<BR><BR>Best regards,<BR>-Paul<BR><BR> - Web Database Developer<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts