Copy pasting data from Excel to Outlook

Pranesh

Board Regular
Joined
Jun 29, 2014
Messages
216
Hi All,

I have a data in excel sheet which I would like to send as email body. In my sheet I have few lines of text few charts, shapes and Pics. Im currently using a code which will copy paste the data to an email. But in that draft email if I scroll down to view the email body the shapes in the email is disappearing. If I scroll up and slowly move it down and when shapes is about to come again it disappears. I have no clue on the issue here. Can someone help me pls.

Below is the code which I use.

Code:
Sub India_BB()
    Dim i As Integer
    Dim ShtToSend As Worksheet
    Dim strSendTo, strbody As String
    Dim strSheetName As String
    Dim strSubject As String
    Dim Hlink As Hyperlink
    Dim rng As Range
    ' add ref - tool -> references - > Microsoft Word XX.X Object Library
    Dim wdDoc As Word.Document '<=========

    Set Mail_Object = CreateObject("Outlook.Application")
    Set Mail_Single = Mail_Object.CreateItem(0)
    Set wdDoc = Mail_Single.GetInspector.WordEditor '<========

    For i = 1 To ThisWorkbook.Sheets.Count
        If Sheets(i).Name = "Sheet3" Then
            Sheets(i).Select
            Set rng = Nothing
            strSheetName = Sheets(i).Name
            strSendTo = Sheet1.Range("A1").Text
            strSubject = Sheet1.Range("B1").Text
            Set rng = Sheets(strSheetName).Range("A1:R67").SpecialCells(xlCellTypeVisible)
                rng.Copy
             
  
            With Mail_Single
                .To = strSendTo
                .CC = ""
                .BCC = ""
                .Subject = strSubject
'               .HTMLBody = RangetoHTML(rng)
                .Display
                 wdDoc.Range.PasteAndFormat wdChartPicture & .HTMLBody = " " '<=======
            End With
        End If
    Next i
End Sub
 

Pranesh

Board Regular
Joined
Jun 29, 2014
Messages
216
Hi - Can someone reply to this? If my question is not clear do let me know.
 

Forum statistics

Threads
1,082,360
Messages
5,364,923
Members
400,815
Latest member
Joaquin Phoenix

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top