Solved

document export to ms word

Posted on 2001-08-08
9
225 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
Comment Utility
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
Comment Utility
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
Comment Utility
how do i setup the word file....

samir
0
 
LVL 4

Expert Comment

by:sloeber
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:SamirKumar
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Is there a way to include any attachments in the Notes doc as well?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

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…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now