Is it possible to insert a table in the cell of the excel sheet.

Jagdev

New Member
Joined
Sep 30, 2014
Messages
11
Hi Experts

I have created a macro in excel which sends the email via outlook to more than user at a point of time. The macro is working fine when I add plain text in the cell, which I am using for the body of the mail. The issue is when I am trying to add the table field in this cell. It won't accept the table and consider it a text and paste it in the body of the outlook as a plain text instead of table. I tried many options but fail to get through it.

The code I am using is mentioned below

I want the msg code below to accept the following content in the cell E

Dear Sir ,

We would like to wish you a Merry chirtmas & Happy New Year.
RefCcyAmountNameDueDate
133456F12INR1,084.00ABC Company15/10/2014

<TBODY>
</TBODY>

Regards,

Jagdev




Code:
 Sub Preview()
I = Cells(2, "B").Value   ' dynamising startrownumber to user fed value at cell B2
Do           ' start the action

Subj = Cells(I, "A").Value
Filepath = Cells(I, "B").Value
EmailTo = Cells(I, "C").Value
CCto = Cells(I, "D").Value
msg = Cells(I, "E").Value

Application.DisplayAlerts = False ' hey macro ,i dont wanna make you take time ,so this command to save time to avoid displays
    Dim OutApp As Object
    Dim OutMail As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    With OutMail
        .To = EmailTo
        .CC = CCto
        .BCC = ""
        .Subject = Subj
        .body = msg
        .Attachments.Add Filepath
        .display
        
        
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
Application.DisplayAlerts = True
I = I + 1
Cells(1, "A").Value = "Outlook sent Time,Dynamic msg preview  count  =" & I - 3
Loop Until Cells(I, "C").Value = ""

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Experts,

I somehow manage to fix the below issue.

I have added the table in the Sheet2 and now the macro pick up it and paste it in the body of the outlook mail. The information of the table needs to be updated everytime. The header in the table will remain the same. I have RAW_Data in sheet3 of the macro. Is it possible to update the table data of sheet2 from Sheet3 (Raw_Data) automatically everytime a mail is generated.

Any help is much appreciated. It will really help me to complete my task before the stipulated time.

Regards,
JD
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,792
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top