Email to single person macro in Outlook

  • Thread starter Thread starter Winnipeg Michael
  • Start date Start date
W

Winnipeg Michael

I had a macro in Outlook 2003, that creates a new message with the person's
name already typed in the To address. Then I just had to type the message in
the body and click "Send".
I'd like to do this again in Outlook 2007, but having difficulty.

Without putting the exact email address in the code, I have the code set up
as this:

Sub Email1()

SendKeys "^" + "n"

SendKeys "(e-mail address removed)"

SendKeys "~"

SendKeys "{TAB 3}"
End Sub

I go back to Outlook, hit Alt+F8, select the macro to run, hit Run, but I
get the dreaded: "The macros in this project are disabled."

What do I need to do for this to run properly?

Thanks,
 
You need to adjust the macro security level; see
http://outlookcode.com/article.aspx?id=49

But also ... SendKeys is never a good solution. Instead, you should be using
the Outlook object model directly. For example:

Set msg = Application.CreateItem(olMailItem)
msg.To = "(e-mail address removed)"
msg.Display
 
Sue,
THANK YOU, THANK YOU, THANK YOU!!!!
Yes, thats how excited I am.

Is there a way to disable the Microsoft Outlook Security Notice, that pops
up the first time I use the macro? I thought, from what I read on your
on-line instructions, that the "Set msg = Application.CreateItem(olMailItem)"
statement would not allow the pop-up to happen.

This is the macro, with a tweak at the end:

Sub email()

Set msg = Application.CreateItem(olMailItem)
msg.To = "(e-mail address removed)"
msg.Display

SendKeys "{TAB 1}"
End Sub


I did keep the TAB 1, so it goes right to typing the email.

Any thoughts?
Thanks,
 
Macro Security is set at:
Warnings for all macros.

I guess it should be set at:
No security check for macros (Not recommended)

Can you confirm that, please?
 
Why not confirm it yourself by clicking the question mark at the upper-right
of the macro security dialog and reading the Help topic?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Sorry.
I guess I was looking for a "its okay to leave it as 'No security check for
macros (Not recommended)' in order for you to run the macro without the
Microsoft Outlook Security Notice to pop-up" reply.

Thank you.
 
If you read through the information in the Help topic, you'll see at the end
a link to instructions for digitally signing your VBA project.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Sorry.
In my giddiness with the macro working, I didnt read the entire contents.

I hope you are referring to this:
Digitally sign a macro project
 
Back
Top