+ Reply to Thread
Results 1 to 2 of 2

Excel sheet to Outlook body

  1. #1
    Registered User
    Join Date
    07-23-2004
    MS-Off Ver
    2007
    Posts
    94

    Excel sheet to Outlook body

    Hello,

    Ive been using a scripts from Ron De Bruin's web site, but I need some help in making it do a little more. I have the below VB, which copys the active worksheet into the email body. Rons code gives me the option to add text to the email but only if I stop using Word as my editor (which id rather not do). Is there any way I can add text to the email and keep word as my editor?

    Thanks for any help.

    Sub Test()
    Dim rng As Range
    Dim OutApp As Object
    Dim OutMail As Object
    With Application
    .EnableEvents = False
    .ScreenUpdating = False
    End With
    Set rng = Nothing
    Set rng = ActiveSheet.UsedRange
    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    With OutMail
    .To = "@"
    .Subject = "Subject"
    .Body = "Hello," & Chr(13) & Chr(13) & "Goodbye"
    .HTMLBody = RangetoHTML(rng)
    .Display
    End With
    On Error GoTo 0
    With Application
    .EnableEvents = True
    .ScreenUpdating = True
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub

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

    In order to provide you with prompt replies to your questions, there are a few rules we ask that you observe. Please remember to follow these rules when you post as a courtesy to your fellow members, and to those who are volunteering their time, and knowledge. If you don't wrap your code, your post will be closed until you contact me.

    Readability is key in getting a fast response to your question. You have many tools available to assist you in formatting your post. Any code you post, whether a worksheet formula or VBA code should be wrapped. You can find a list of other HTML format options in the forum rules.

    How to Wrap your Code
    On the Message window Toolbar you will see the # icon. Select the text you want to appear in a Code Window, and Click the # icon. This will wrap the code for you. You can also do this manually by placing the tag [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the last line.

    You can read the Forum rules by clicking on the link below.
    Forum Rules
    If you have any questions, contact me by clicking on my name Leith Ross

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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