Solved

document export to ms word

Posted on 2001-08-08
9
229 Views
Last Modified: 2013-12-18
can someone tell me how to export information in a notes document to ms word.  i guess the template name will be c:\temp\text.doc.  

i need the code for notes and also how to setup the word template.

if you need more info please email me at samir_6@hotmail.com
0
Comment
Question by:SamirKumar
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 4

Accepted Solution

by:
sloeber earned 200 total points
ID: 6367032
Here's an example of how you can do that
reate in your view an action, name it "ExportToWord"
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"
wordObj.fileClose

Next
Set WordObj = Nothing


End Sub

Greets,
Sloeber
PS : Thanks to stamp
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6367041
If you have already a word template.
And you want just in a couple of fields from notes.
Like, if you'll write a letter to all the user.
The letter is the same only persons name is different.
Then you can make Bookmarks, where you want to have a notes field value.
Dim session as new notessession
dim db as notesdatabase
dim view as notesview
dim dc as notesdocumentcollection
dim doc as notesdocument
dim i as integer

Dim wordobj as variant
set wordobj = createobject("word.application.8)
wordobj.documents.open"c:/temp/tekst.doc"
word.obj.visible = True

set db=session.currentdatabase
set dc = db.unprocesseddocuments
for i=1 to dc.count
set doc = dc.getnthdocument(i)
................
................


Greets,
Sloeber
0
 

Author Comment

by:SamirKumar
ID: 6367710
how do i setup the word file....

samir
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 4

Expert Comment

by:sloeber
ID: 6367767
In which example
In the first example, you must do nothing
In the second just make a word document and save it, and use the same name of your document in your code
that's all

greets,
sloeber
0
 

Author Comment

by:SamirKumar
ID: 6369903
can you send me a database with it and the word template...

if i have four field (name, age, ssn, and id) in a view and I want the template to look like:

Name (Notes Field)
Age (Notes Field)......

I must have to put some data inside the word template to expect different values.

if you email the stuff to samir_6@hotmail.  please zip the files.  thanks
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6371536
Samir,

I've send you a database and a word document.
If you open it, just choose a document in the view, and choose then Action >> Export to Word

You can always update the agent.
I've made it very fast so it isn't perfect written, but it works ;-)

There are also other method to work with, like FX and so...
But why look to other method, if this one works.

Greets,
Sloeber
0
 

Expert Comment

by:giusepe
ID: 6372998
Slober, could you send me this database with the template that you sent to Samir to my email ??

if you are agree, please send it to
 technobambino@yahoo.com

Thanks and regards
0
 

Expert Comment

by:giusepe
ID: 6373002
i forgot,

or if you already have it Samir, could you send the database and the template to my email wrote in the comment above ???
0
 

Expert Comment

by:DavidAbbott
ID: 8326278
Is there a way to include any attachments in the Notes doc as well?
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…

831 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