How to convert Notes Document into a Word Doc and make the file read only File---Please help

Hi All,

Here is my code —I am converting a Notes Document into a word Doc and for some reason, the Notes Document doesn’t show into Word …Please help

Here is my code ina form Action Button called “Generate Word Doc”

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim db As NotesDatabase

Dim uidoc As NotesUIDOcument

Dim doc As NotesDocument

Dim contdoc As NotesDocument

Dim contview As NotesView

Dim view As NotesView

Dim view1 As NotesView

Dim view2 As NotesView

Dim view3 As NotesView

Dim view4 As NotesView

Dim officeapp As Variant





Dim dateTime As New NotesDateTime( "" )

Dim strdate As String

Dim dc As NotesDocumentCollection

Dim dc1 As NotesDocumentCollection

Dim dc2 As NotesDocumentCollection

Dim dc3 As NotesDocumentCollection

Dim worddocs As Variant

Dim worddoc As Variant

Dim worddoc2 As Variant

Dim range As Variant

Dim object As Variant



Dim tableobj As Variant

Dim Application As Variant

Dim i, j ,k As Integer

Dim yearonly As Variant

Dim monthonly As Variant

Dim dayonly As Variant

Dim reqnum As String

Dim newday As String

Dim newmonth As String

Dim newyear As String

Dim padding As String

Dim filename1 As String

Dim recipient As Variant

Dim dt1 As New NotesDateTime(Now)

Dim dt2 As New NotesDateTime(Now)

Dim filename2, filename3  As String





Dim doc2 As NotesDocument

Dim doc3 As NotesDocument

Dim item2 As String

Dim s,y,z As String

Dim username As NotesName

Dim fname As  NotesName

Dim dname As Notesname

Dim item1 As Variant

Dim result As Variant

Dim myrecipient As String

Dim xname As Notesname







On Error Goto ProcessError



Set db = session.CurrentDatabase

Set username = New NotesName(session.UserName)



Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document



If doc.ContactName(0) = "" Then

	Messagebox("Please enter Contact name")

	Exit Sub

Else

	

	

	Set officeapp = createobject("Word.Application")

	officeapp.visible =  True

	Set worddoc = officeapp.documents.add()

	

	Call uidoc.SelectAll

	Call uidoc.Copy

	officeapp.Selection.PasteAndFormat (0)

	Call uidoc.deselectAll

	

	

	padding = doc.SupplierID(0)

              		

	result = Evaluate("@Platform")

	

	filename1 =Environ$("UserProfile")

	Call officeapp.ActiveDocument.Saveas(filename1 + "\My Documents\price quotes\" + padding +  ".doc")

	officeapp.ActiveDocument.Protect 1,  , "Price Quotes"

officeapp.PrintOut OutputFileName =filename1, Background = True

		Call dt1.Adjustsecond(30)

	

	Do Until dt2.TimeOnly >= dt1.TimeOnly

		Set dt2 = New NotesDateTime(Now)

	Loop

	

	

		

	officeapp.ActiveDocument.Close

	officeapp.Quit  

	

              End If

ProcessError:

'WordObj.Quit  

Exit Sub

When I see Word Doc , it generated the filename with blank , nothing in it

Please help what is it that I am doing wrong here.

Thanks,

ac ac

Subject: How to convert Notes Document into a Word Doc and make the file read only File—Please help

ac,I’m not sure why you’re putting into a Word doc, but let me suggest an alternative.

Try printing to an Adobe PDF. It’s extremely easy.

Lots of issues using the MS Office classes. To me, the biggest issue is the fact that they tend to change from release to release of MS Office. This becomes really nasty if you have some folks on Office 2007 and some on Office 2002, for example.

I really hope the idea of the PDF file works.

It’s just File/Print and select Adobe PDF as the “printer”. Of course, you need Adobe Acrobat installed to make this work.

Good luck!

Subject: RE: How to convert Notes Document into a Word Doc and make the file read only File—Please help

Thanks Dan,

Now my question how can I automatic via button create a PDF / or print the PDF and mail send the File attachment to a user …by one click of a button programmatically…

Is it possible withought having a PDF writer?

Because the license costs and we have atleast 1000 users …

Please advise,

Thanks in advance

ac ac

Subject: RE: How to convert Notes Document into a Word Doc and make the file read only File—Please help

ac,OK - If Adobe doesn’t work, why not print to Microsoft Office Document Image Writer with File/Print.

I’m assuming your users have MS Office…

This produces a *.tif file.

Subject: RE: How to convert Notes Document into a Word Doc and make the file read only File—Please help

Thanks Dan, but how can I automatically print , make as attachment and send it to the user via click of a button?

Please help

Thanks in advance

ac ac

Subject: One free method I know but it is JAVA based

a library called “ITEXT”

and you have to code the creation of the PDF

Subject: RE: How to convert Notes Document into a Word Doc and make the file read only File—Please help

Hi AC,

If yuo are good in using the code with some modifications, you can try my code…

http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1244719,00.html

I think really it is helpful to you. But I am a bit busy to explain you the senario.

Regards,

Venugopal Reddy