A macro to show images

E

Equilibrium

I've used a macro to show images in outllok 2003 , this is the macro:
*******************************************************************************************************************

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Sub view_attachments()
On Error Resume Next


Dim oOL As Outlook.Application
Dim oSelection As Outlook.Selection


Set oOL = New Outlook.Application
Set oSelection = oOL.ActiveExplorer.Selection
Set fs = CreateObject("Scripting.FileSystemObject")


vPath = "c:\Attachments_Outlook\"
If Not fs.FolderExists(vPath) Then fs.CreateFolder vPath


vHTMLBody = "<HTML><title>View Email Attachments</title>"


For Each obj In oSelection
vSubject = "<FONT face=Arial size=3>Attachments from: <b>" _
& obj.Subject & "</b><br>"
vHTMLBody = vHTMLBody & vSubject
For Each Attachment In obj.Attachments
Attachment.SaveAsFile (vPath & Attachment.FileName)
vHTMLBody = vHTMLBody & Attachment.FileName & "</Font><br>"
& _
"<IMG alt="""" hspace=0 src=""" & vPath &
Attachment.FileName & _
""" align=baseline border=0><br><br><br>"
Next
Next
vHTMLBody = vHTMLBody & "</html>"


Set ie = CreateObject("internetexplorer.application")
With ie
.toolbar = 0
.menubar = 0
.statusbar = 0
.Left = 100
.Top = 100
.Height = 480
.Width = 640
.navigate "about:blank"
.document.Open
.document.Write vHTMLBody
.document.Close
.Visible = True
End With


Do Until ie.readyState = 4: Sleep 10: Loop
Set ie = Nothing


For Each obj In oSelection
For Each Attachment In obj.Attachments
fs.DeleteFile (vPath & Attachment.FileName)
Next
Next


Set fs = Nothing
Set objMsg = Nothing
Set oSelection = Nothing
Set oOL = Nothing
End Sub

*******************************************************************************************************************

but the output is a browser window with image sign and not the actual
image.
pasting the generated code of this page & saving to a new web html page
can be watched succesfully in a web browser.

Why?

Please assist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top