+ Reply to Thread
Results 1 to 4 of 4

Sending Outlook Attachments with VBA

  1. #1
    Registered User
    Join Date
    06-16-2008
    Location
    Arlington, VA
    MS-Off Ver
    2007
    Posts
    93

    Sending Outlook Attachments with VBA

    I am using the code below to select a recipient and attach the corresponding attachment. I am getting an error saying that the oject does not allow this and the code seems to stop at the line directly following. What do I need to change?
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by nms2130; 01-07-2011 at 12:36 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Sending Outlook Attachments with VBA

    Hi,

    Untested but probably because you've Dimmed 'attacher' as a Workbook object. The .Add instruction is expecting to see a string reference which should be the complete drive\path\folder\filename.

    That may in fact be your existing attstr variable but I can't tell whether this includes the full drive\path\folder string.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sending Outlook Attachments with VBA

    I doubt you can attach an open workbook using this method (sending open files generally warrants SendMail which is limited in terms of other functionality like body etc...)

    edit: probably wrong though...

  4. #4
    Registered User
    Join Date
    06-16-2008
    Location
    Arlington, VA
    MS-Off Ver
    2007
    Posts
    93

    Re: Sending Outlook Attachments with VBA

    Richard was completely right. I changed the .Add portion to the string and removed the open workbook section. Works like a charm!

    Thank you

+ 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