sexta-feira, março 04, 2005

Colocar a informação de attachments nas respostas

Quando recebo uma mensagem e faço Reply (Responder) posso ver os campos: From, Sent, To e Subject.
Gostaria de ver o campo Attachment, como fazê-lo?

Código VBA

Sub ReplyWithAttachs()

Set objInsp = Application.ActiveInspector
Dim intpos As Integer
Dim nomedoattach As String
Dim i As Long
Dim lngCount As Long
Dim objattachments As Outlook.Attachments
Dim strnamefile As String
Dim strtxtnomeattach As String
strnamefile = "C:\strattachs.txt"

If Not objInsp Is Nothing Then
Set objitem = objInsp.CurrentItem
If objitem.Class = olMail Then
Set objattachments = objitem.Attachments
lngCount = objattachments.Count
If lngCount > 0 Then
For i = lngCount To 1 Step -1
nomedoattach = objattachments.Item(i).FileName
Open strnamefile For Append As #1
strtxtnomeattach = nomedoattach
Write #1, strtxtnomeattach
Close #1
Next i

Set objreply = objitem.Reply
With objreply
Open strnamefile For Input As #1
Do Until EOF(1)
Input #1, strtxtnomeattach
.Body = vbCrLf & "File attached: " & strtxtnomeattach & .Body
Loop
Close #1
Kill strnamefile
.Display
End With
Else
Set objreply = objitem.Reply
With objreply
.Body = .Body
.Display
End With
End If
End If
End If
End Sub

Sem comentários: