+ Reply to Thread
Results 1 to 12 of 12

VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on this

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on this

    Dear all,
    i use below code to generate mails in outlook using excel vba.
    This code works perfectly fine but i have seen an unusual issue when outlook mail gets generated.
    There is a table that gets exported into outlook mail, if you select this table completely, you will see 2 EXTRA ROWS below the existing rows with data.

    These Rows are invisible, but if you look at it carefully on the space it holds in the mail, you will feel this extra space below the table.

    I have attached sample template as well..Can you please help to avoid these 2 Empty Rows at the end of table after outlook mail gets generated..????
    Any alternatives is also most welcome..


    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by mchilapur; 08-19-2016 at 01:54 PM.

  2. #2
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Did any one found the issue..?
    Last edited by mchilapur; 08-19-2016 at 01:55 PM.

  3. #3
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373
    Quote Originally Posted by mchilapur View Post
    Did any one found the issue..?
    Working on this for you sir.

  4. #4
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Try this please

    Please Login or Register  to view this content.
    Last edited by 1aaaaaaaaaaaaaaa; 08-19-2016 at 03:30 PM.

  5. #5
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Dear Poizhan,
    Your codes fixes my issue..But could let me know where exactly was the issue and what change you did to fix this..?

  6. #6
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Hi, would be more than happy to, I just hope this explanation is understandable :P

    1.) I modified the code that was looking at the temp wb range, before it was adding an extra row of cells, I used the "End(xlUp).Row" method for finding the last row of data, then stored that range into a variable "rng_used" (A to lastrow, E to lastrow) and styled rng_used directly. Note: I modified the publish objects code to point to the new range variable
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    2.) I noticed that excel's default setting for exporting excel data/formatting to HTML markup was having it add an additional <tr> (table row) </tr> for "ifSupportMisalignedColumns" browser property so I figured we could take that out to get rid of the extra row. I created two Int variables, one to hold the position of the 1st character of the HTML string where we wanted to start removing markup, and a 2nd character to find the position where we want to stop removing markup (by using instr() function, and adjusting the end search string for the # of characters in the search string, in this case 11). After we find our positions, we can image chopping our HTML string variable into three parts, left, middle and right, in effect we are chopping out the middle and attaching the left directly to the right (by using a temp variable), then once we are done we return the temp variable to the function as RangeToHTML and we are done

    Please Login or Register  to view this content.
    html_.jpg
    Attached Images Attached Images

  7. #7
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Man, you are genius...
    I have one more issue with this code, it doesnt pull images in signature..Can you help me on that..?

    I know this question is not related to this post, if you want i can re-open one more..
    Many Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Sure... If your primary account in Outlook already has a default signature use this instead. (Make sure .Display is first )

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Thanks for your fast response, Below code doesnt pull the signature..I had tried it even before...
    Any Alternatives..?
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Make sure .Display is the first line of code inside the With block.

  11. #11
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Thats Great...Many Many thanks for your help...
    I learned something new from you today...
    I will changed this post to 'SOLVED'..
    Have a great day ahead..

  12. #12
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA code adds 2 empty invisible (But selectable) line in outlook mail..Need fix on thi

    Thank you sir, you too, God bless you and your Excel/VBA endeavours

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Display a multi-line text box from User Form in a generated outlook e-mail
    By Tnashnhsp1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2015, 06:11 AM
  2. [SOLVED] Code to send mail copying from Excel to a new outlook mail.
    By paz1987 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-11-2015, 07:54 AM
  3. [SOLVED] Excel 2007 VBA - Multiple line header adds empty line in between
    By ChrisPatterson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2014, 08:54 AM
  4. [SOLVED] Adding a 2nd line to body of outlook e-mail
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-22-2014, 11:48 AM
  5. code to attach the draft mail in new compose mail as attachment in outlook 2010
    By priya1987 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2012, 08:38 AM
  6. How can I use Outlook express to send mail rather than Outlook by VBA code
    By new.microsoft.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-03-2005, 11:05 AM
  7. [SOLVED] How can I use Outlook express to send mail rather than Outlook by VBA code
    By new.microsoft.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2005, 08:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1