Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > ASP
Back to Active Server Pages Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Using WordprocessingML
Glenn Kaufman 
     
8 months ago
Has anyone used wordprocessingML to open an XML word document and write feilds from a form into the word document. Trying to open and edit a word docx template with data from a SQL database using MS VB code and asp form. I am getting errors as the VB loads saying missing syntax from the very first line in the code.
code error
| Public Sub CreateWordprocessingDocument(ByVal filepath As String) expecting a ")" |

CODE:
DetailsPublic Sub CreateWordprocessingDocument(ByVal filepath As String)
    ' Create a document by supplying the filepath.
    Using wordDocument As WordprocessingDocument = WordprocessingDocument.Create(filepath, WordprocessingDocumentType.Document)

        ' Add a main document part.
        Dim mainPart As MainDocumentPart = wordDocument.AddMainDocumentPart()

        ' Create the document structure and add some text.
        mainPart.Document = New Document()
        Dim body As Body = mainPart.Document.AppendChild(New Body())
        Dim para As Paragraph = body.AppendChild(New Paragraph())
        Dim run As Run = para.AppendChild(New Run())
        run.AppendChild(New Text("Create text in body - CreateWordprocessingDocument"))
    End Using
End Sub

....
Richard Rost  @Reply  
          
8 months ago
Remember, ASP is not like VBA. You don't declare variable types in subs or functions. It's expecting just

Sub CreateWordprocessingDocument (filepath)

And I bet a lot of the rest of that code is designed for VBA too, not ASP. ASP is a scaled-down version of VBScript.
Alex Hedley  @Reply  
            
8 months ago
Also would you not need MS Word installed on the Server your website is hosted on?
Alex Hedley  @Reply  
            
8 months ago
Oh it's the Open XML SDK, does that have a VBS API?

Structure of a WordprocessingML document
https://learn.microsoft.com/en-us/office/open-xml/word/structure-of-a-wordprocessingml-document?tabs=cs
Richard Rost  @Reply  
          
8 months ago
Also remember your filepath is going to be relative to THE SERVER, not your local drive.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Active Server Pages Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 1/16/2026 2:12:45 AM. PLT: 0s