+ Reply to Thread
Results 1 to 19 of 19

Copy Range to EMail-Body using ClipBoard

  1. #1
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Copy Range to EMail-Body using ClipBoard

    Hi all,

    I've wrote a function that allows me to insert a certain range to the body of an email. This email is composed in the code, too.
    So far I am able to build the emails body as plain text. Does anybody now how to retain the cell format also (colors, font size, border styles, ...)?

    Please Login or Register  to view this content.
    Thank you very much!

    Kind regards,
    Lloyd

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range to EMail-Body using ClipBoard

    Lloyd

    Wouldn't you need to use a rich text field?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    Hi Norie,

    sorry, I don't understand what you mean.

  4. #4
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    I now know I need to convert my excel range into HTML format, to represent it the same way like in excel. But I don't know how to do this.

    Any ideas?

    Lloyd

  5. #5
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Copy Range to EMail-Body using ClipBoard

    Try

    .htmlbody = strtext & .htmlbody

    or RangetoHTML might work

    .htmlbody = rangetoHTML(your range)
    Last edited by djdjdj; 01-31-2014 at 06:19 AM.

  6. #6
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    This line throws an error:

    Run-time error '438':

    Object doesn't support this property or method

  7. #7
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Copy Range to EMail-Body using ClipBoard

    What if you add:

    Please Login or Register  to view this content.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,457

    Re: Copy Range to EMail-Body using ClipBoard

    Have a look at Ron de Bruin's web site. He has a function to convert a range to HTML ... well functions to do pretty much anything with email.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  9. #9
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    Line
    Please Login or Register  to view this content.
    throws an error:

    Compile error:

    Sub Function not defined


    Is rangetohtml member of a certain reference?

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,457

    Re: Copy Range to EMail-Body using ClipBoard

    I think that RangeToHTML is the RdeB routine to which I referred. Go get it ...

  11. #11
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Copy Range to EMail-Body using ClipBoard

    @ TMShucks yes it is, I got the code from a colleague, great stuff

    @Lloyd, sorry I forgot to give you the function. Here's the link to Ron de Bruin's full code including the range to html function

    http://www.rondebruin.nl/win/s1/outlook/bmail2.htm

  12. #12
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    Hmm,

    this code runs through but the emails body is empty.

  13. #13
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    @TMShucks

    Please Login or Register  to view this content.
    What is the .nsf File?
    It looks like storing some user specific data, right?
    I found several of this files on my machine, but non that points out it contains some user specific data.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,457

    Re: Copy Range to EMail-Body using ClipBoard

    Please Login or Register  to view this content.
    What is the .nsf File?
    No idea. Where did you get that code from? All you need is RdeB's function. See below with some examples.


    Please Login or Register  to view this content.

    Examples:

    Please Login or Register  to view this content.

    Regards, TMS

  15. #15
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Copy Range to EMail-Body using ClipBoard

    Nothing doing, the body is always empty. Do I gloss over anything?

    Please Login or Register  to view this content.

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,457

    Re: Copy Range to EMail-Body using ClipBoard

    Am I right in thinking that this is Lotus Notes that you're using? I have no knowledge of Notes and I cannot test your code.

    But, there are examples on RdeB's site, specifically aimed at Lotus Notes users.

    http://www.rondebruin.nl/win/s1/notes/notes6.htm

    And Google: ron de bruin lotus notes to get many other examples that might be transferrable into your code.

    Sorry.

    Regards, TMS

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range to EMail-Body using ClipBoard

    The code in post #1 is for Lotus Notes not Outlook.

  18. #18
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,457

    Re: Copy Range to EMail-Body using ClipBoard

    Sadly, I just saw "copy range to email body".

    I then picked up from post #7 which refers to rangetohtml (I think our posts overlapped) and provided the link.

    There are clearly much better examples on RdeB's site specifically for Lotus Notes.

    At this point, I will quietly drop out and fade into the background ... where I will watch with interest.

    Regards, TMS

  19. #19
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range to EMail-Body using ClipBoard

    TMS

    I think that last link you posted might be what the OP is looking for, at first glance it does appear to work by pasting to the body of the email.

    I was looking for something like that but forgot Ron DeBruin had pages covering Lotus Notes.

+ 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. Find the range of a table & copy/past into body of an Outlook email
    By JamesGilchrist in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2014, 08:44 PM
  2. [SOLVED] Vba code copy range and paste special in email body
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2013, 12:48 PM
  3. Replies: 2
    Last Post: 08-01-2012, 02:47 PM
  4. email a clipboard copy as imbedded in body
    By oletrol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2009, 10:05 PM
  5. Copy a range to the body in email message
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2008, 02:52 PM

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