Results 1 to 2 of 2

Thread: Email with outlook using vba

  1. #1
    Junior Member
    Join Date
    May 2015
    Posts
    1
    Rep Power
    0

    Email with outlook using vba

    Hi,

    I have this excel file which I would like to email the contents of the scorecard sheet in outlook in the body with/without attachment.
    I have used your previous macro and modify it a bit but it doesn't work
    I'm quite new with macro so not sure where went wrong but I got error 1004 when I tried to run the vba.
    Need your kind help!
    Attached Files Attached Files

  2. #2
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    It seems to largely work here; I got no error 1004, but I did get an error 400 which turns out on my Windows 7, Excel 2010 (32 bit) to be caused by this code (where I have commented out the lines giving trouble):
    Code:
            With .Cells(1)
                '.PasteSpecial Paste:=8  '8 as table
                .PasteSpecial xlPasteValues, , False, False
                '.PasteSpecial xlPasteFormats, , False, False
                .Select
            End With
    You seem to be missing some of Ron de Bruin's code to attach files to the email; you need to add the following snippet of his just before:
    Code:
    'Resolve each Recipient's name.
    missing lines:
    Code:
      ' Add attachments to the message.
      If Not IsMissing(strAttachmentPath) Then
        If Len(Dir(strAttachmentPath)) <> 0 Then
          Set objOutlookAttach = .Attachments.Add(strAttachmentPath)
        Else
          MsgBox "Unable to find the specified attachment. Sending mail anyway."
        End If
      End If

Similar Threads

  1. outlook macro for email manaement
    By PSB in forum Hire A Developer
    Replies: 0
    Last Post: 01-07-2014, 04:03 AM
  2. Replies: 6
    Last Post: 05-25-2013, 07:36 PM
  3. Replies: 2
    Last Post: 05-23-2013, 08:08 AM
  4. Replies: 1
    Last Post: 05-22-2013, 01:50 PM
  5. How To Send Outlook Email Using VBA
    By mfaisalrazzak in forum Excel Help
    Replies: 7
    Last Post: 03-03-2013, 03:09 AM

Posting Permissions

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