none
VBA can't export module "Set objOutlookAttach = .Attachments.Add(AttachmentPath)" RRS feed

  • Question

  • Windows 10 Enterprise, Access 2016 VBA:

    I can't export a module that contains the following line:

    Set objOutlookAttach = .Attachments.Add(AttachmentPath)

    I get the error "File not Found".

    But if I REM the line, I can Export the Module.

    'Set objOutlookAttach = .Attachments.Add(AttachmentPath)

    Probably Windows Defender!


    Tuesday, August 6, 2019 10:07 AM

All replies

  • Hello John,

    What string do you pass to the Attachments.Add method?

    Set objOutlookAttach = .Attachments.Add(AttachmentPath)

    The error clearly states that a file can't be found according to the file path passed to the Add method. 

    The source of the attachment can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Tuesday, August 6, 2019 11:44 AM
  • Our IT informed me that Defender found a virus. It's a False Positive.
    Tuesday, August 6, 2019 7:01 PM