Why is attachment.Add not working in VBA excel

Anonymous
2022-07-08T15:44:37+00:00

Hi - I have a beginner with VBA and came across a code to enable me to add an attachment to emails from a path location. but an errors has occurred - why would this be? Thanks in advance

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-07-08T16:42:03+00:00

    You don't show the code for setting the path - make sure that it includes a terminal "" like one of these:

    path = ThisWorkbook.Path & ""

    path = "C:\Folder with files"

    You can also troubleshoot by adding this line just before:

    Msgbox attachment

    And you may need to lose the ()s around attachment

    0 comments No comments