How to open an attached .doc in RTF

I have a Word doc in a RTF. How do I open the doc.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim template As Variant

Dim ws As New NotesUIWorkspace



Set db = Session.CurrentDatabase

Set view = db.GetView("Attachment")



Set doc = view.GetFirstDocument



If doc Is Nothing Then

	Exit Sub

Else

	

	Set rtitem = doc.GetFirstItem( "Attachment" )

	If ( rtitem.Type = RICHTEXT ) Then

		Msgbox "Found"

		Set template = rtitem.GetEmbeddedObject("Microsoft Word Document")

		'Set handle = template.Activate( False )

	End If

	If Isempty(template) Then

		Messagebox "No import file specified", MB_OK+MB_ICONSTOP, "Error"

		Exit Sub

	End If

Dim Word As Variant

	Set Word = CreateObject("Word.Application") 'Create Word Object

	Word.Visible = True

	

	'Word.Documents.Open importFilePath$ ' Open the Word file 

	Word.Documents.Open template ' Open the Word file 

	

	

	

End If

End Sub

I get an ‘Automation object argument type mismatch’

Word opens but the document doesn’t.

Does anyone know why and if so how do I fix it?

Thanks

Subject: How to open an attached .doc in RTF

If you are using an embedded object then you were on the right track with the activate method of notesEmbeddedObject.once you have a handle to the embedded object you can use the activate method to open it.

Set handle=template.activate(true)

'Ture=show user iterface 'false = hide user interface

if you are using an attached object then you use the extractfile method of notesEmbeddedObject. Then create an instance of word and open the document

The word.documents.open method requires a string that points to a word document or template on the filesystem e.g. “c:\template.dot”. you are currently trying to pass it an object that is of the NotesEmbeddedObject class

hope that helps

Tim