Improve company productivity with a Business Account.Sign Up

x
?
Solved

Export Notes Documents to Word

Posted on 2000-05-05
2
Medium Priority
?
519 Views
Last Modified: 2013-12-18
I need to export documents contained in views to Word, according to LotusScript this is possible with OLE. I need the CODE to do this or where can i find sample CODE to Export TO WORD. URGENT.

To have an idea of the documents and the database i am working on, this is for more detail:

I am working in a database in Lotus Notes and i need to create a document in Word with the information contained in different views of the database.
The structure of the documents in the database are: there are documents type Document, Response and Response to Response. What i need is create a document in Word where i can obtain the informaion in that Notes database.
Is it possible to create such document in such a manner that when the datbase in updated, the docuemnt is updated also?
I have been trying exporting the views to an ascii file and then open that file in Word, but such document can not be updated automatically. Also i have used an ODBC to catch the information, but because of the structure in the types of documents ( response, response to response ) the tables in Access are separated and can not obtain the information of the documents properly.

Is there any way that you know where i can create a Word document with the information contained in the Notes Database (Views )and make that document updated when the database changes or maybe create an agent to do this?

DATABASE
    VIEWS
        DOCUMENTS ( Document, Response,   Response to Response )    
            .......
            .......
            .......
            .......
            .......
             ....
              ..
              ..
       Word Document ( Updated )
 
I will be very thankfull with all the ideas that you can provide me to solve this.
Thanks.
0
Comment
Question by:giusepe
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
stamp earned 60 total points
ID: 2900915
Hi giusepe,

this is a tested copy from here:
http://www.martinscott.com/Site/DesignLibrary.nsf/f7cf0bf6ffdb8cec852566c1005348b2/a772d7a19cc467ee85256739003a073e?OpenDocument

And here how I did it...

Create in your view an action, name it "ExportToWord97"
Place into "Click" event this code:
Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim collection As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim idpath As String
      Dim rtitem As NotesRichTextItem
      Dim object As NotesEmbeddedObject
      Dim wordobj As Variant
      Dim add As String
      Dim sal As String
      Dim LastName As String
      Dim FullName As String
    ' this code uses many of the Wordbasic commands in Word 97
    'set up the word document
      
      Set wordobj = CreateObject("Word.Basic.8")
      If WordObj Is Nothing Then
            Msgbox "There was a problem loading MS Word."
            Exit Sub
      End If
      
      Set db = session.CurrentDatabase
      Set collection = db.UnprocessedDocuments
      For i = 1 To collection.Count
            Set doc = collection.GetNthDocument( i )
            Call session.UpdateProcessedDoc( doc )
    'get the Address, Salutation , lastname and fullname fields    from    the current document
            
            add=doc.MailAddress(0 )
            sal=doc.Salutation(0)
            LastName=doc.LastName(0)
            FullName=doc.FullName(0)
            
    ' create new doc in MS Word
            WordObj.filenew  
            wordobj.font "Univers"
            wordobj.fontsize 11
            
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            
    ' time format i.e 5 Febuary, 1999
            DateTimeFormat="d MMMM, yyyy"
            
    ' inset the text and the field values
            wordobj.insert "Our Ref:"
            wordobj.insertpara
            wordobj.insert "Your Ref:"
            wordobj.insertpara
            wordobj.insert "IPC:"
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            
            
            wordobj.insert "Date:"
            
            wordobj.InsertDateTime    DateTimeFormat
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            wordobj.underline
            wordobj.insert "For the attention of : "
            wordobj.insert Fullname
            wordobj.underline
            wordobj.insertpara
            wordobj.insertpara
            
            wordobj.insert add
            wordobj.insertpara
            wordobj.insertpara
            wordobj.insertpara
            
            wordobj.insert "Dear  " & Sal &  "  " & Lastname
            wordobj.insertpara
            wordobj.insertpara
            
            wordobj.insert "Subject:"
            wordobj.insertpara
            wordobj.insertpara
            
            
      WordObj.fileSaveAs "myNew" & i & ".doc"
            
      Next
      
      
End Sub


Now go to the client, select some of your docs and click on the  "ExportToWord97" action button.

So, this was for 20 Points. What you have to do is testing with abowe code (I hope you have Word97). Check for some variables contained in your docs to transfer to WordDocs. When you have enough tested, then you can forget this and do it with OLE objects. But for this I do not have a immediate example...


So long,
stamp
0
 
LVL 4

Expert Comment

by:stamp
ID: 2901028
I forgot...

place after:
WordObj.fileSaveAs "myNew" & i & ".doc"

this statement:
wordObj.fileClose

and after the "next" loop end close word with this:
Set WordObj = Nothing

So, now your question how to update docs in a folder; well, you have to have any criteria in your notesdocs what the name of worddoc should be.
The abowe action owerwrites yhe previous word.docs at next run time.
So you get your update. If you want to have it running electricaly, place the code to an agent, click on shareble box, give it selection: "If documents have been created or modified" and look at it...

Regards,
stamp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

595 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question