Hi All,
I would like to extract an Excel File Attachment but it gave me the error “Object Variable Not Set” for rtitem.
What’s wrong with this coding:
Dim rtitem As Variant
Set rtitem = doc.GetFirstItem( “Body” )
Dim fileCount As Integer
fileCount = 0
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
Call o.ExtractFile _
( "c:\Participants.xls" & Cst(fileCount) )
End If
End Forall
End If
Thanks in advanced.
Subject: Extract File Error
When I debug, the error is at this statement:
If (rtitem.type = RICHTEXT ) Then
It gave me Object Variable Not Set error. What’s wrong?
Subject: RE: Extract File Error
Hi Shaun,
If you get the error at the ‘If (rtitem.type= RICHTEXT) then’ statement, it is the object ‘rtitem’ that is not set. The reason for this could be that the document does not contain the item ‘Body’.
When you debug, under the variables tab, make sure the variable ‘rtitem’ gets a value (or and object). You should see a ‘+’ sign on the left of the variable name.
Regards
Arild Eidesund