+ Reply to Thread
Results 1 to 8 of 8

Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

  1. #1
    Registered User
    Join Date
    09-20-2012
    Location
    Peoria, Arizona
    MS-Off Ver
    Excel 2013
    Posts
    39

    Wink Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Hi Folks,

    I have a bit of a problem trying to get an Excell Macro to separate lines when launching an email in Outlook. To be more specific, I have created a VBA userform which one can fill out then send to MS Outlook by clicking on a Command Button. I have created it because the email to fax service is confusing to use. I have created several TextBoxes to separate the infomation needed for a proper cover sheet. When the command button is hit, it sends the information filled out in the text boxes to the body of the email. The problem is that it reads as a solid line. For example:

    "To: John Doe From: Tazyote # of Pages: 4 Comments: Here is that report you asked for. Let me know if I can help you out. Thanks"

    I would like to have the macro automatically {Enter} after each line so that the body of the email looks like this:

    To: John Doe
    From: Tazyote
    # of Pages: 4
    Comments: Here is that report you asked for. Let me know if I can help you out. Thanks


    I have been unable to figure out how to do this. Here is the macro I am using so far:
    Please Login or Register  to view this content.
    Any ideas on how to do this? I have attached a screen shot of the UserForm so everyone can visualize what I am talking about. Thanks
    Attached Images Attached Images
    Last edited by Leith Ross; 12-26-2013 at 09:12 PM. Reason: Added Code tags

  2. #2
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Remember to tag your code.

    Email uses html tags to manage the text styles. So treat this like a webpage.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-20-2012
    Location
    Peoria, Arizona
    MS-Off Ver
    Excel 2013
    Posts
    39

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Wow, Thanks for putting me on track. It looks like I need to get more knowledge on webpage programing. However, how would I incorporate this into the line below? I tried using the < BR > and this causes the body of the email to just enter out as a 0. I am probably just missing something real simple. Thanks

    .htmlbody = "To: " & TextBox5.Value & " From: " & TextBox6.Value & " # of Pages: " & TextBox7.Value & " Comments: " & TextBox8.Value

    I will also upload the form as an attachment if this is a real head scratcher for anyone.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-20-2012
    Location
    Peoria, Arizona
    MS-Off Ver
    Excel 2013
    Posts
    39

    Talking Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Thanks for providing some direction. I have started to play with the < BR > and still cannot get it to work. When I use this, the body just defaults to a "0" so I must be doing something wrong. How would this play into this line:

    .htmlbody = "To: " & TextBox5.Value & " From: " & TextBox6.Value & " # of Pages: " & TextBox7.Value & " Comments: " & TextBox8.Value

    I will also try to upload an .xlsm with a button to launch the macro if anyone wants to play with it. The solution to this would open alot of possibilites for future projects. Thanks!!!!

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Hello Tazyote,

    To create an HTML body, it must meet the basic structure of an HTML document. Here is your macro with the needed changes...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    09-20-2012
    Location
    Peoria, Arizona
    MS-Off Ver
    Excel 2013
    Posts
    39

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Ok, I get it! Thanks SOOOOOOOOOO MUCH!!!! The HTML Doc has to be created first then dropped into the body of the outlook commands. This makes sense. I made some minor changes but this works like a charm! Thanks again.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-27-2013 at 02:28 AM. Reason: Added Code Tags

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    Hello Tazyote,

    You're welcome.
    Is Tazyote a combination of Tasmanian (Devil) and Coyote? That would be a dangerous combination.

  8. #8
    Registered User
    Join Date
    09-20-2012
    Location
    Peoria, Arizona
    MS-Off Ver
    Excel 2013
    Posts
    39

    Re: Using Exell VBA to launch Outlook Email while separating lines in the body of Outlook.

    I guess it is. The story behind it will make it sound a bit less menacing. We used to own an Australian Shepherd - Australian Cattle dog mix and we thought it was fitting to name him Taz as he seemed so Aussie to us. I also really liked Coyotes at the time and enjoyed reading about them (there were a ton of them where I lived). In any case, I was tying to figure out a good username for some forum and could not find a good name that seemed to fit me. My dog came up to me at that moment and seemed to look a lot like a Coyote. So I called him a Tazyote out of jest. It then hit me that this would be a unique username that would be easy to remember and fit my personality. Thus the name was born. Nothing menacing or dangerous intended, just a combination of two interests of mine...and it does not hurt that I love Australian culture (even though I have never been there). Never met an Aussie I did not immediately like. Great country.

+ 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. Launch outlook and Email specific range of cells
    By Jvollmer33 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-19-2013, 07:09 PM
  2. export outlook 2007 email into excel with subject and body of email
    By akulka58 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2013, 02:37 PM
  3. Replies: 2
    Last Post: 08-01-2012, 02:47 PM
  4. Outlook Email Body to Excel
    By Sciortmj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2012, 02:10 PM
  5. Outlook email url in body
    By kevinho in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2005, 07:48 AM

Tags for this Thread

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