Sorry, I’ve been out of touch for a long time. I have a need to print an MSWord attachment from a Notes database. I searched the forum for suggestions but found none.
I’d be perfectly happy getting a 3rd party tool if that were the solution. Otherwise, I need a hint as to where to look to get some answers for writing some code to do this (if it’s even possible). thanks!
First of all, printing Word docs from Lotus without using any extra tool IS possible–I’ve done it in the past, but too long ago to remember exact code, sorry :-(. I will describe you the problem and ways of solution, hope this would be a bit of help.
I needed to print a Word doc, attached as RTItem to Notes Doc. If your problem is the same, you need:
get view with Notes Document
get ND from the view
get RTI from document
then, using VisualBasic commands, detach file to some temporary directory and print it.
Here goes sample code, I wouldn’t give a guarantee, but this at least can help you make questions to your VisualBasic colleagues.
'specify the location where file is detached
Dim szTempPath As String
szTempPath="C:\Temp\"
'detach file from document
Dim RTItem As NotesRichtextItem
Set RTItem = DocTemplate.getFirstItem( "AttachementFile" )
'generate a unique temporary name of the file that you detach
'I just use 6-digit random number, converted to string
Dim szTemFileName As String
Randomize
szTemFileName=Right(Cstr(Rnd()),6)
Call RTItem.embeddedObjects( 0 ).extractFile( szTempPath & szTemFileName & ".doc" )
'create Word document
Dim varApplication As Variant
Set varApplication = createObject( "Word.Application" )
varApplication.documents.add( szTempPath & szTemFileName & ".doc" )
Dim varDoc As Variant
Set varDoc= varApplication.ActiveDocument
varApplication.visible = False
' True allows to preview the document, however, you need to click Print icon manually and remove the following line to avoid error
Call varDoc.printOut()
'you also might need to delete the temporary file, I remember some probs w it, so I hid the next line
'Kill szTempPath & szTemFileName & ".doc"