Getting type mismatch error

I have to create a button that will copy an email into Word, detach attachments into a temp directory and then embed the attachments into word. The attachments can be of anytype. I’m getting a type mismatch.

I’m getting bugeyed looking at this. Can somebody help me please?

Thank you,

Marilyn

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Set uidoc = workspace.CurrentDocument

Set doc =uidoc.Document

Dim oWord As Variant

Dim range As Variant

Dim table1 As Variant

Dim table2 As Variant

Dim send1 As String

Dim item As NotesItem

Dim delim As String

delim = ";"

Dim ret As String

Dim A As String



Set item = doc.GetFirstItem("SendTo" )

Dim item2 As NotesItem

Set item2 =doc.GetFirstItem("EnterCopyTo")



Set oWord = CreateObject("Word.Application.8")

oWord.Visible = True

Set oDocument = oWord.Documents.Add()



Set range =oWord.Selection.Range

Set table1 = oWord.Selection.Tables.Add(range,5,2)

table1.Borders.Enable = False

oDocument.Tables(1).Cell(1,1).Range.InsertBefore (doc.From(0))

oDocument.Tables(1).Cell(2,1).Range.InsertBefore (doc.PostedDate(0))

Forall v In item.Values

	oDocument.Tables(1).Cell(1,2).Range.InsertBefore (v)

End Forall

Forall c In item2.Values

	oDocument.Tables(1).Cell(2,2).Range.InsertBefore (c)

End Forall



oDocument.Tables(1).Cell(3,2).Range.InsertBefore (doc.BlindCopyTo(0))

oDocument.Tables(1).Cell(5,2).Range.InsertBefore (doc.Subject(0))



For x=1 To 5

	oWord.Selection.MoveDown

Next

With oWord.Selection

	.MoveDown

	.InsertParagraph

End With



Dim MyRange As Variant

Set MyRange = table1.Range

With MyRange

	.Collapse 0

	.Move(1)

	.Select

End With



Set table2 =oDocument.Tables.Add(MyRange, 1,1)

table2.Borders.Enable = False

table2.Cell(1,1).Range.InsertBefore(doc.Body)



'Embed Attachments

Forall item1 In doc.Items

	If(item1.Type = RICHTEXT) Then

		If Isarray(item1.EmbeddedObjects) Then

			Forall o In Item1.EmbeddedObjects

				If (o.Type =EMBED_ATTACHMENT)	 Then

					Call o.ExtractFile("D:\Temp\" & o.Name)						

					oDocument.InlineShapes.AddOLEObject,"","D:\Temp & o.Name", 0, 1, 1, o.Name

					

				End If

			End Forall

		End If

	End If

End Forall

End Sub

Subject: Getting type mismatch error

Which line are u getting error ? Add Error Handler and see which line the error is coming.

Raj

Subject: RE: Getting type mismatch error

It’s this line and I can’t figure out what’s wrong with it.

oDocument.InlineShapes.AddOLEObject,“”,“D:\Temp & o.Name”, 0, 1, 1, o.Name