• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Tbl Col width changes while pasting from excel to outlook body in html format

kaushik03

Member
Hi all,


I have automated a daily report (which earlier involves some sort manual work) by which user would be able to send(through e-mail) the report to all the intended recipients on click of a button.


In addition to my code, I have taken the reference of Ron's code to send the report content in html format (pasting the content in the body of the email). Below here is the reference I am talking about.


http://www.rondebruin.nl/mail/folder3/mail4.htm


Everything seems to work properly. But when the excel table gets pasted in the body of the outlook and outlook e-mail window opens, I could see there is a significant difference in the Col width in comparison to what it is there in the excel sheet.


The code actually opens up a TempWB(please see the above link for reference) and paste the data from the original workbook. I have run through the code line by line and I saw that in the TempWB data gets pasted in the same format as it there in the original workbook, before it gets published in html format.


So I am not able to understand why the Col width changes while it comes in the outlook.


I understand it is little difficult to provide the solution for this problem without looking at the entire code that I have written (in addition to Ron's code) in order to see what exactly is happening. However, I just wanted to check in if this is something common (because of some reasons which I am not aware of) that you might understand and guide me in the right direction.


However, I will upload my workbook (with dummy data) either today late evening or tomorrow early morning.


Thank you for your assistance in advance.


Kaushik
 
Hi Kaushik,


Did you try copy the range from worksheet and paste it into outlook manually? Did you see any difference in col width? If you see any difference in the above case, there will not be any options afaik.
 
Hello experts,


Just got stuck in some other works and could not follow this up. Sorry!!


Here is the sample workbook.


http://speedy.sh/3zGGQ/Myalert.xlsm


The "My New Worksheet" of the sample workbook contains data (colored) which is generated from a raw data(which I have not given here). Once the data gets generated in the desired layout in the "My New Worksheet".....the all we need to do is to send the content of this sheet to the intended recipients through e-mail.


I have used, Ron's code to send the content in the body of the email (please see the 'emailmod' module of this workbook). Everything is working fine except the below problem which I am not able to correct.


The code copying the range from "My New Worksheet", opens a new temporary workbook ('TempWB' as per the code), paste the data in this workbook keeping the original format as it is, publish the same into HTML format into the body of the e-mail.


When the outlook window opens up, the width of ColB is completely going for a toss (increased a lot). The current Col width of ColB is 65.57 which should be there in the mail as well.


To answer Dhamo's question, yes I tried copy+paste the range manually and seems to be ok then, but something is happening with code which I am not able to understand.


Note: the code which is executed before generating the email (or before calling 'Mail_Range_Outlook_Body' macro), I have not given here.


Till now below here I tried to deal with this problem:


1)Instead of creating a new workbook and paste the content, I tried to copy and paste the range as picture (enhanced metafile) and pass the same in the outlook body but with no avail.


2)In outlook we can manually adjust the table Col width. But I could not see any option in outlook to record the macro in order to understand how it works in outlook through code.


It would be really very helpful if you could help on this in order to correct the Col width.


Regards,

Kaushik
 
Back
Top