Outlook Command Button code

Jan 19, 2011
Reaction score

I am really struggling to get an Outlook 2007 command button to run any code.

I have created a custom appointment/calendar form with a command buttom with the default name of CommandButton1. I don't have much experience with programing so I have just gone off what I have found on the web, which has led me to try opening VB while in the form design and creating the following basic script (just to test it) - both by double clicking "ThisOutlookSession" and typing it in and also by creating a new module and adding it in...

Sub CommandButton1_Click()
MsgBox "Test"
End Sub

It works when you press play within the VB editor and I have published the form but no matter what I try, I cannot get the button to do anything. I have dropped the security down to "run all macros" but again no success.

What I am actually trying to do is create a button that opens a new email with a field being inserted in the subject and another field being inserted into the body (no need for it to be sent or for any recipient details to be added) but I haven't even got as far as trying to find out how to insert fields into an email!

I am guessing that I am not assigning the code correctly or placing it in the right place. Any help would be most appreciated.

Many thanks


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question