+ Reply to Thread
Results 1 to 2 of 2

excel to email problem

Hybrid View

  1. #1
    Registered User
    Join Date
    01-17-2014
    Location
    wisconsin
    MS-Off Ver
    excel 2010
    Posts
    9

    excel to email problem

    i am able to send emails of worksheets through outlook. what code do i use to open up the actual outlook message window with the attached file rather than just sending it through. i want to be able to type what ever i want in the message body and not have it based on whats in the vba code.

  2. #2
    Registered User
    Join Date
    01-17-2014
    Location
    wisconsin
    MS-Off Ver
    excel 2010
    Posts
    9

    Re: excel to email problem

    this code does what i want it to do. could anyone help me on how to change to attaching a worksheet instead of the entire book? also would like to have the attachment name be what the file tab name is

    Sub Mail_workbook_Outlook_1()
    'Working in Excel 2000-2013
    'This example send the last saved version of the Activeworkbook
    'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
        Dim OutApp As Object
        Dim OutMail As Object
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        On Error Resume Next
        With OutMail
            .to = [j1].Value
            .CC = ""
            .BCC = ""
            .Subject = [c1].Value
            .Body = "Dear all, " & _
                    vbCrLf & vbCrLf & _
                    "the stock model has been updated." & _
                    vbCrLf & vbCrLf & _
                    "Please find it attached for your review. " & _
                    vbCrLf & vbCrLf & _
                    "Thanks, " & _
                    vbCrLf & _
                    "Matthew"
            .Attachments.Add ActiveWorkbook.FullName
           
            .Display
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub

+ 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] Excel vba to create email - having a FROM (problem)
    By wrightyrx7 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-17-2014, 08:11 AM
  2. Problem amending email subject in Outlook using Excel VBA
    By madbloke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2012, 12:09 PM
  3. Email and Excel Problem
    By carl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-22-2006, 03:50 PM
  4. [SOLVED] Problem opening excel files from email
    By DXC001 in forum Excel General
    Replies: 1
    Last Post: 10-03-2005, 03:05 PM
  5. Sending email from Excel vba problem
    By PaulC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-17-2005, 08:13 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