Hi,
How do I use VBA to create an email, attach a temporary version of the active workbook and then paste a range from a sheet within the workbook as an image?
Thanks in advance.
Hi,
How do I use VBA to create an email, attach a temporary version of the active workbook and then paste a range from a sheet within the workbook as an image?
Thanks in advance.
Type "Email from excel" in the search box
.
https://www.rondebruin.nl/win/s1/outlook/mail.htm
Create what you are able to ... then post your workbook with your macro code and specify your problem/s.
Hi,
This is as far as I got, it will create an email, save the workbook as temp and attach to the email, now I need it to also paste an image of the range as defined...
![]()
Sub Email_CurrentWorkBook2() Dim OlApp As Object Dim NewMail As Object Dim TempFilePath As String Dim FileExt As String Dim TempFileName As String Dim FileFullPath As String Dim MyWb As Workbook Dim wordDoc As Word.Document Set MyWb = ThisWorkbook With Application .ScreenUpdating = False .EnableEvents = False End With TempFilePath = Environ$("temp") & "\" FileExt = "." & LCase(Right(MyWb.Name, Len(MyWb.Name) - InStrRev(MyWb.Name, ".", , 1))) TempFileName = MyWb.Name & " - " & Format(Now, "DD.MM.YYYY") FileFullPath = TempFilePath & TempFileName & FileExt MyWb.SaveCopyAs FileFullPath sheet1.Range("A1:Z100").Copy Set OlApp = CreateObject("Outlook.Application") Set NewMail = OlApp.CreateItem(0) On Error Resume Next With NewMail .To = "a@b.com" .Subject = "DASH" .Body = "" .Attachments.Add FileFullPath '--- full path of the temp file where it is saved .Send 'or use .Display to show you the email before sending it. End With Set wordDoc = OlApp.GetInspector.WordEditor 'To paste as picture wordDoc.Range.PasteAndFormat wdChartPicture On Error GoTo 0 Kill FileFullPath Set NewMail = Nothing Set OlApp = Nothing With Application .ScreenUpdating = True .EnableEvents = True End With End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks