+ Reply to Thread
Results 1 to 7 of 7

Adding a 2nd line to body of outlook e-mail

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Adding a 2nd line to body of outlook e-mail

    Hi all, need help with this please

    I have some code that edits a .vbs file with the ultimate intention of sending an e-mail. I'm stuck in this bit of the code

    Please Login or Register  to view this content.
    This is a simplified version of the code because what I'm really doing is looping and gathering many cells (so its not as simple as Body = CellA1 & CellA2) but I want each cell to be on a different line in the e-mail.

    At the minute it either comes out all on one line or errors out.

    Hope someone can help with this please. Thanks in advance.

    John

  2. #2
    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,428

    Re: Adding a 2nd line to body of outlook e-mail

    No, not as simple as:
    Please Login or Register  to view this content.
    You'll need something like
    Please Login or Register  to view this content.
    So, in a loop, you'll need to vbCrLf before you add each element to the body.

    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


  3. #3
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: Adding a 2nd line to body of outlook e-mail

    Hi TMS, thanks for the reply. I know its something very close to what you have suggested but I just can't seem to get the right format.

    Here is the actual loop:

    Please Login or Register  to view this content.
    And here is the produced VBS file (As you can see, the body spans several lines but just produces a VBS error.
    Please Login or Register  to view this content.

  4. #4
    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,428

    Re: Adding a 2nd line to body of outlook e-mail

    Please post a sample workbook

    Regards, TMS

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

    Re: Adding a 2nd line to body of outlook e-mail

    Doesn't Print add a carraige return after each line of text you send to the file?
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: Adding a 2nd line to body of outlook e-mail

    File attached, I'm on Office 2003 and Win 7 Pro.

    Cheers
    Attached Files Attached Files

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

    Re: Adding a 2nd line to body of outlook e-mail

    Perhaps.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: Adding a 2nd line to body of outlook e-mail

    Excellent! Works exactly as I need. Thank you both so much for your help.

    Very much appreciated.

    Thanks again
    John

+ 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. I want to open up an outlook e-mail with info. pre-set in the subject and body...
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2014, 10:47 AM
  2. Format Outlook Mail Body using VBA
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2014, 07:02 AM
  3. Excel VBA outlook - Range in mail body
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2013, 06:33 AM
  4. Send e-mail with image on body (.html) on e-mail manager <> outlook
    By mariotnc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:28 PM
  5. Replies: 1
    Last Post: 07-07-2006, 07:40 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