Dear all, I have to create a word file. I have a backend view. I just want to print the values of various documents simply into a word file…
Please can someone give me pointers in how to go about doing it.
Thanks in advance.
Anju
Dear all, I have to create a word file. I have a backend view. I just want to print the values of various documents simply into a word file…
Please can someone give me pointers in how to go about doing it.
Thanks in advance.
Anju
Subject: To create and write into a word file
Below is the code i used to create word doc and export data from uidoc. Similarly u can get data from notes document as well. Hope this helps u.
=================
Function CreateWordDoc(docSelected,docPolicy)
On Error Goto processerror
Dim wordObj As Variant
Dim word As Variant
Dim wordoc As Variant
Dim boxType As Long
Dim answer As Integer
Dim wordcontainer As String
Dim WordDoc As Variant
Dim doc As Variant
Dim uidoc As notesuidocument
Dim FilePrefix As String
Dim FileName As String
FilePrefix="C:\File name "
FileName=FilePrefix+docPolicy.txtDocTitle(0)+" "+docPolicy.txtRevison(0)+".doc"
On Error Resume Next
Set word = CreateObject("Word.Application") 'Create Word object
word.Visible = False
Set doc = word.Documents
Call doc.Add
Set uidoc = uws.EditDocument(True,docPolicy)
Call uidoc.Refresh()
Call uidoc.GotoField( "txtAttachment" )
Call uidoc.SelectAll
Call uidoc.Cut
Call uidoc.DeSelectAll ' it to the clipboard
word.Activate
word.Selection.Paste ' Pastes the copied uidocument into the new word document
Call uidoc.GotoField( "txtBody" )
Call uidoc.SelectAll
Call uidoc.Cut
Call uidoc.DeSelectAll ' it to the clipboard
word.Activate
word.Selection.GoTo wdGoToPage, wdGoToNext
word.Selection.Paste ' Pastes the copied uidocument into the new word document
Call word.ActiveDocument.SaveAs(FileName)
Call word.ActiveDocument.Close
Call uidoc.FieldSetText ("Check","No")
Call uidoc.close
word.quit
Exit Function
processError:
Msgbox "Error at Line No. "+Cstr(Erl())+" Error:"+Error$+" In Create Word Doc(script lib)",16,"Error"
End
End Function
===================