aayaanmayank
Board Regular
- Joined
- Jul 20, 2018
- Messages
- 157
Hi Can someone help that why i am getting half of the when exporting image from excel through VBA.
below is my code
below is my code
VBA Code:
Sub send1()
Dim sh1 As Worksheet
Set sh1 = ThisWorkbook.Sheets("sheet1")
Set sh = ThisWorkbook.Sheets("Template")
Dim OLOOK As Outlook.Application
Set OLOOK = New Outlook.Application
Dim omail As Outlook.MailItem
Set omail = OLOOK.CreateItem(olMailItem)
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Template")
Dim ch As ChartObjects
Sheets("DL").Activate
LR1 = Sheets("DL").Range("A" & Rows.Count).End(xlUp).Row + 1
LR2 = Sheets("DL").Range("A" & Rows.Count).End(xlUp).Row + 1
Set emailRng = Worksheets("DL").Range("A2:A" & LR1)
Set emailRng1 = Worksheets("DL").Range("B2:B" & LR2)
For Each cl In emailRng
sTo = sTo & ";" & cl.Value
Next
For Each cl1 In emailRng1
sTo1 = sTo1 & ";" & cl1.Value
Next
tmp = Environ("USERPROFILE") & "\Desktop\" & "Mypic.Bmp"
sTo = Mid(sTo, 2)
sTo1 = Mid(sTo1, 2)
With omail
omail.To = sTo
omail.CC = sTo1
omail.Subject = Sheets("DL").Range("C2").Value
omail.HTMLBody = "<BR> " & " <style=border: none>" & _
"<table align=""center"">" & _
"<img src = '" & tmp & "' >"
omail.Display
End With
sh1.Pictures.Delete
sh.Activate
End Sub