Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to send a friend an e-mail that has a clickable button in the message body... The button will run a macro.

I know you can do macros on your side of things, such as:

Private Sub Application_ItemLoad(ByVal Item As Object)
    MsgBox "Hey Look a Macro!"
End Sub

Which will run a macro when I load a new e-mail.

I'd like to attach this macro to run when the button in the e-mail I sent is clicked on. Btw, I don't mind if the receiving user receives warnings about the macro, just so long as they can execute it via a button

I'd like to know:

  • Is that possible?
  • How do I do it?


Edit: All I see are ways to run a macro on my side, not send an executable macro to someone else

enter image description here

share|improve this question
What have you researched and/or tried so far? – CharlieRB Jul 12 '13 at 19:49
@CharlieRB I've researched a lot but only found ways to run a macro for myself, not send an executable macro to someone else. I've updated above with the stuff I see – Growler Jul 12 '13 at 19:51
This will almost certainly not work, as this was a popular method of transfering viruses and malware for years. It can work, but befault MS Office and Windows will block these types of operations and / or throw messages and warnings. – AthomSfere Jul 12 '13 at 19:52
@AthomSfere throw messages on my end and prevent transfer of macro, or just warnings to them (but they can still run the macro)? – Growler Jul 12 '13 at 19:53
Likely the latter, but your email provider might also block the attached code. – AthomSfere Jul 12 '13 at 19:54

You've tagged your question with Outlook, so one option open to you is to use a custom form. Distribution of that form is easier if you're in the same Exchange organization, although it's still possible if not. There's an excellent writeup on this page, including creating the form and publishing it to other users.

Note that this option assumes that your sending the code is not a one-off occurrence, but rather something that you do on a regular basis.

You don't say much about your end goal, but if you're just trying to give your friend a button to press, other strategies could include using the (free) Visual Studio Express to create a small VB EXE, and send it to your friend (in a zipped format to avoid the Outlook security warning) - or, just send them a dropbox link to the EXE itself.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .