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.
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Ref[/TD]
[TD]Ccy[/TD]
[TD]Amount[/TD]
[TD]Name[/TD]
[TD]DueDate[/TD]
[/TR]
[TR]
[TD]133456F12[/TD]
[TD]INR[/TD]
[TD]1,084.00[/TD]
[TD]ABC Company[/TD]
[TD]15/10/2014[/TD]
[/TR]
</TBODY>[/TABLE]

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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

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