Not clear to me what you want. You want each image in its own table? Why? Is there other data? Don't need HTML table structure just to display images in email.
Why do you concatenate strEmailImages for .HTMLBody twice?
Perhaps you could do a mockup in Excel of how you want this email to appear.
As advised, work it out in steps. Start with basic and expand. Get a simple loop working first. Consider:
Code:
Dim strPath As String, strFile As String, strEmailImages As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = New Outlook.Application
Set MailOutLook = appOutLook.CreateItem(olMailItem)
strPath = "T:\DMT Ltd\Cam Images\"
strFile = Dir(strPath & "*.jpg")
Do While strFile <> ""
strEmailImages = strEmailImages & "<IMG src= " & strPath & strFile & " width=100 height=100><br>"
strFile = Dir
Loop
With MailOutLook
.To = "some address"
.Subject = "Some Subject"
.HTMLBody = "Please find images we have taken:<br>" & strEmailImages
.Display
End With
Modifed to use table and row structure:
Code:
strTableStart = "<table style='text-align:left;border:3px solid blue;font-family:calibri;border-collapse:collapse;padding:5px'>"
strIntro = "<tr style='background:white;mso-highlight:blue'>Please find images we have taken: </tr>"
strTableEnd = "</table>"
With MailOutLook
.To = "some address"
.Subject = "Some Subject"
.HTMLBody = strTableStart & strIntro & strTableEnd & strEmailImages
.Display
End With
Alternative is to zip images to Windows Compression folder and attach to email.