Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Macro that sets up an email?

  1. #11
    Guest

    Default

    On 2002-02-27 03:59, Douglas wrote:
    If you just want to send the active open workbook, you could use Excel's "Send to Mail Recipient as Attachment" function (located in the file menu.
    In VBA this would be:

    Application.Dialogs(xlDialogSendMail).Show _
    arg1:="e-mail address", _
    arg2:="Subject Line"

    arg1 is the e-mail address in standard format (is x@xy.com etc)
    arg2 is what will appear in the subject line.

    The result of this code is to open a new e-mail window, attach the file and complete the To: and Subject lines - you have to manually press SEND.

    Hope this helps
    D
    What to do if I want to send only one sheet and not the whole workbook?
    Is this possible?
    Many thanks.

  2. #12
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Excel2000 Yes

    File > Send to > mail recipient

    Then select Send sheet

    Ivan

  3. #13
    Guest

    Default

    On 2002-02-27 03:22, dognz wrote:
    Hi,
    See the code below - this is a example of how to automate the sending of emails with attachments. If you step through the code you will see which lines to change to suit your needs - you can attach multiple files by repeating the "attachments.add" instruction.

    Sub OUTLOOK_test_Email()

    'creates link to Outlook
    Dim objOL As New Outlook.Application
    Dim objMail As MailItem

    On Error Resume Next

    Set objOL = New Outlook.Application
    Set testsemail = objOL.CreateItem(olMailItem)



    'sets charactersitics for email
    With testsemail
    'requests a read confimeration receipt for the email
    .ReadReceiptRequested = True
    'sets receipent
    .To = "Testing, Testing"
    'enters subject
    .Subject = "Test Email"
    'displays email to allow manipulation fro comments
    .Display
    'enters text for email
    .Body = "Testing Email"
    attach1 = .Attachments.Add("c:temptest.xls", , 60)
    End With

    End Sub


    Hope this helps,

    Dognz
    This is the way to send an attachments.Is there also a way to send only one sheet of a workbook and not the hole workbook
    Many thanks.

  4. #14
    New Member
    Join Date
    Feb 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the coding. But just a quick question, can the program send out an email automatically without my click the SendandReceive button? If this can be done, it will be great because I can use Excel to generate query results and automatically send out to customers.

    John

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •