Word document upload


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Word document upload

  1. #1
    Sven Guest

    Word document upload


    Hi,

    I want to upload a word document with a word VB macro in my database. If
    I finish a document I just want to start a macro which uploads it to the
    SQL Server.

    Right now I can upload a document over an ASP WEB Interface which copies
    the document to the server and then inserts the file as BLOB by using the
    stream object. If I use my Word macro I can create a new document on the
    server but I could not upload the document itself as a BOLB. I tried the
    same code as in the ASP:

    Dim mStream As New ADODB.Stream
    mstreamType = 1
    mStream.Open
    mStream.LoadFromFile FileName
    querystr = "SELECT * FROM Docs WHERE ID=0"
    ObjectRs.Open querystr, cn
    ObjectRs.AddNew
    ObjectRs.Fields("BLOB") = mStream.Read
    ObjectRs.Update
    ObjectRs.Close

    The mStream.Read gives me back the message: Operation is not allowed in this
    context. Do I have to change something in the Word options ?

    A better way would be to use directly the word object to upload it to the
    server and not the file but I didn't found such an object in the help files
    of VB Word

    Could anybody help me ?

    Thanx

    Sven






  2. #2
    Sven Guest

    Re: Word document upload


    Hi,

    I found the error. I forgot the point to set the Stream type to 1.

    thanx

    Sven


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center