+ Reply to Thread
Results 1 to 3 of 3

Attachments.Add error

  1. #1
    Registered User
    Join Date
    09-22-2021
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    2

    Attachments.Add error

    Hello.

    I've tried to make an macro which will send an email with an attached PDF from my spreadsheet.

    So far so good I've managed to make it work, but for some reason it will now crash and give the highlighted error on .Attachments.Add Fname, where it tells me that the path doesn't exist or wasn't found. The only problem is, that the exact same macro just created that PDF, but in the same macro it tells me it doesn't find the path.
    If I remove the Attachments.Add Fname the macro manage to send the email correctly just without my PDF.

    In VBa it looks like this:
    Please Login or Register  to view this content.
    Hope that anyone can help me out here.

    Daniel

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 09-22-2021 at 11:50 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Attachments.Add error

    For Attachments.Add you will need to use the full pathname of the file, not just the file name. Where are you saving the PDF file when you create it?
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-22-2021
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Attachments.Add error

    What would the code tag be in this case?

    How can I put in the full path name, when the macro will create the file on the saving location? And the file names will change every time according to the data in the spreadsheet. The location can be changed but I’ve tried this with different saving-location when you go to Options > Save

+ 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] Adding attachments to outlook - "Run-time error 91: Object variable or With block variable
    By Deniouz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2021, 12:22 PM
  2. [SOLVED] Error with .Attachments.Add
    By RyanMoran1990 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2021, 03:28 PM
  3. [SOLVED] Error handling for macro that sends emails with different attachments
    By kylegascho in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-30-2019, 11:08 AM
  4. Error when adding attachments
    By sevanseriesta in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-13-2019, 04:14 PM
  5. Bad File Name error 52- Code to group email attachments
    By L_Misty in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 09-06-2017, 07:33 PM
  6. Send multiple emails with different attachments if attachments found
    By AnkitJain in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2015, 05:35 AM
  7. User form to add attachments and send the form and attachments via outlook
    By scorchio83 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2013, 03:46 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