Attach a file to an outlook email

I attach the same file into outlook emails on a regular basis. I am new to Keyboard Maestro and have googled attach a file to an outlook email. There are several posts about it, with several attempts to do it. So far none of the attempts I have found have worked. It looks like executing an AppleScript might be the best way to accomplish this. So I tried to right this little script, using the Mac script editor. It would not let me save it until I got all of the syntax errors corrected. But nothing happens when I try to run the script.

This is what I have:

set fileattach to "Users/path/file.pdf"

tell application "Microsoft Outlook"

make new attachment with properties{file:fileattach}

end tell

If you have managed to get it to work and can tell me what I have done wrong that would be great.

Thank you.

You didn't mention exactly which methods you tried that didn't work for you. Did you happen to find/try this one?

I'm aware it's ancient, but this worked for my version of Outlook (v16).

It's very difficult to use AS to add an attachment -- unless you also use AS to create the outgoing mail in the first place. If you don't then the easiest way is use KM to send ⌘E and drive the standard dialog.

Perhaps if you explained the workflow you are trying to achieve?

Oh. The email that i’m trying to attach a file to is not a new email. This is my work flow.

  1. I receive an email.
  2. I hit reply to that email.
  3. I attach a file to that email. It is always the same file.
  4. I have already created a macro to insert the standard reply.
  5. Hit send, to email it.

Try this. It'll replace steps 2 and 3 in your workflow, and you can either call your current "Standard Reply" macro by adding an "Execute Macro" action at the end or copy that macro's actions over to this one.

It'll work on a single selected message, making a reply with an attachment. Change the second line of the AppleScript:

set theFile to alias "Macintosh HD:Users:nigel:Desktop:Test PDF.pdf"

...to point to your file -- so if it's the file "Standard Form.xlsx" in the folder "Forms" in your "Documents" folder and your home folder is "steve" then

set theFile to alias "Macintosh HD:Users:steve:Documents:Forms:Standard Form.xlsx"

Tested on Legacy Outlook, but should work with New Outlook too (I'll check when I get home).

Outlook Reply to Selected Message with Attachment.kmmacros (3.0 KB)

Image

Did you get a chance to test this? It did not work for me.

I hadn't -- but I have now and it completely fails in New Outlook (which is even worse at AppleScript than I remembered...).

If you want to do lots of Outlook automation consider switching back to Legacy Outlook (and don't forget to tell them why in the dialog that comes up). IMO, Legacy is a better, more feature-complete, version anyway.

If you want, or have to, continue with the hobbled New Outlook you'll have to drive the UI. This will show you how -- put the path to your attachment in the first action:

Outlook Reply to Selected Message with Attachment UI Version.kmmacros (7.7 KB)

Images

These are all actions you'll use in many different macros in the future and you can read about them on the Wiki, but ask if you've any questions.