1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Sub test28032014()
Dim ViewPointInfoTxt
Set FSO = CreateObject("Scripting.FileSystemObject")
ViewPointInfoTxt = origin(0) & "/" & origin(1) & "/" & origin(2) _
& "/" & sight(0) & "/" & sight(1) & "/" & sight(2) _
& "/" & up(0) & "/" & up(1) & "/" & up(2) _
& "/" & Myfield & "/" & Myfocus & "/" & Myzoom & "/" & ProjeMode & "/" & RenderMode
Dim ADR As String
ADR = "C:\temp\snapshot.jpg"
Set Courrier = ActiveInspector.CurrentItem
NbPJ = Courrier.Attachments.Count
If NbPJ > 0 Then
Set Afile = FSO.GetFile(ADR)
Afile.Name = Replace(Afile.Name, "snapshot", "snapshot" & CStr(NbPJ))
ADR = Afile.path
End If
Dim EmbAtt As Attachment
Set EmbAtt = Courrier.Attachments.add(ADR)
Select Case Courrier.BodyFormat
Case olFormatHTML:
OuCommenceAdresse = InStr(1, Courrier.HTMLBody, "</body", vbTextCompare)
If OuCommenceAdresse > 0 Then
fin = InStr(OuCommenceAdresse + 5, Courrier.HTMLBody, ">") + 1
BaliseBody = Mid(Courrier.HTMLBody, OuCommenceAdresse, fin - OuCommenceAdresse)
Courrier.HTMLBody = Replace(Courrier.HTMLBody, BaliseBody, _
"<img src='cid:" & EmbAtt.FileName & "' height=390 width=720 alt='" & ViewPointInfoTxt & "'>" & "<BR>", 1, 1, vbTextCompare) & BaliseBody
End If
End Select
Courrier.Save
Kill (ADR)
End Sub |
Partager