Hi,
I have some code(below), that I am trying to use to select a range, then email as a picture.
However, it comes up with a syntax error in the first row.
Does anyone have any ideas on this please??
Thanks in advance.
Sub eMailPictureInBody()
''' Set Range you want to export to file
Dim rgExp As Range
Dim OutApp As Object
Dim OutMail As Object
Set rgExp = Agency Order Sheet.Range("E1:AG22")
''' Copy range as picture onto Clipboard
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
''' Create an empty chart with exact size of range copied
With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
Width:=rgExp.Width, Height:=rgExp.Height)
.Name = "Pict1"
.Activate
End With
''' Paste into chart area, export to file, delete chart.
ActiveChart.Paste
ActiveSheet.ChartObjects("Pict1").Chart.Export "C:\temp\Pict1.jpg" '
ActiveSheet.ChartObjects("Pict1").Delete
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "xxxxxxxx@aol.com"
.CC = ""
.BCC = ""
.Subject = "Agency requirements for Sunday"
.HTMLBody = .HTMLBody & "<img src='c:\temp\pict1.jpg'>"
.Display
.Send 'or use .Display
'
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Bookmarks