keystroke for sending mail...

M

Mark

I'm a recent migrant from Thunderbird (company imposed)

After opening up a contact window, I want a simple keystroke (like
ctrl-m) to send mail to that contact.

It looks like my only options now are alt-a-m (alt, actions, mail) or
moving my hand to the mouse to click on the new message button.

I thought I could record a macro and assign it to a keystroke but it
appears that Outlook does not have a Macro record function.

Any suggestions?

TIA,
Mark
 
D

Darren

Click on tools, macor, and then Visual Basic Editor

Create a new Module. You can keep the default name of Module1, but I
recommed you change it. Do not name the module the same name as the
sub.

Post the following code to your macro.

Sub Sendmailthiscontact()

' This macro will send an email to an open contact
On Error GoTo Endlable
Dim ns As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim Item As Object
Dim strContactInfo As String
Dim dataObject As MSForms.dataObject

' ------------------------------------------------------------------
' This portion of macro was created to obtain the email address from
the open contact
' If you do not have an opend contact, the macro will fail.
' ------------------------------------------------------------------

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem

If myItem.Email1Address <> "" Then
strContactInfo = myItem.Email1Address
End If

' ------------------------------------------------------------------
' This portion of macro opens a new mail item
' ------------------------------------------------------------------

Set myItem2 = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem2.Recipients.Add(strContactInfo)
myItem2.Display

Endlable:
Set myNameSpace = Nothing
Set myFolder = Nothing
Set myItem = Nothing
Set myItem2 = Nothing

End Sub
 
M

Mark

But it gets more complicated,
After getting the macro to work, I get a message that says a program is
trying to access "your email addresse" allow for then I'm given a combo box
1 min, 2 min, 3 min etc...
requiring more keystrokes...

argggh


Mark
 
D

Diane Poremsky [MVP]

that's outlook's security. which version of outlook? have you checked
outlookcode.com for methods to avoid the prompts?
 
M

Mark

2003. No but I will now. Thanks,
Mark

Diane Poremsky said:
that's outlook's security. which version of outlook? have you checked
outlookcode.com for methods to avoid the prompts?
 
M

Mark

Wow, way more complicated than I have time for...

Thanks for the pointer however.
Mark
 
D

Darren

Review the following code using Redemptino. In addition, creating your
own certificate.

Sub Sendmailtest()

' This macro will send an email to an open contact
On Error GoTo Endlable
Dim ns As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim Item As Object
Dim strContactInfo As String
Dim dataObject As MSForms.dataObject

' ------------------------------------------------------------------
' This portino of macro was created to obtain the email address from
the open contact
' ------------------------------------------------------------------

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem

' Use redemption library to create safe mailitem
Dim SafeContact, oContact
Set SafeContact = CreateObject("Redemption.SafeContactItem") 'Create an
instance of Redemption.SafeContactItem
'Set oContact = Application.Session.GetDefaultFolder(10).Items(1) 'Get
a contact item from Outlook, can be any other contact
SafeContact.Item = myItem 'set Item property of a SafeContact to an
Outlook contact item
'SafeContact.Item = oContact 'set Item property of a SafeContact to an
Outlook contact item

If SafeContact.Email1Address <> "" Then
strContactInfo = SafeContact.Email1Address 'access Email1Address
property from SafeContact, no warnings are displayed
'MsgBox SafeContact.Email1Address
End If

' ------------------------------------------------------------------
' This portion of macro opens a new mail item
' ------------------------------------------------------------------

Dim SafeItem, oItem
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an
instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add (strContactInfo)
'SafeItem.Body = "Test Body"
SafeItem.Subject = "Test Subject"
SafeItem.Display

Endlable:
Set myNameSpace = Nothing
Set myFolder = Nothing
Set myItem = Nothing
Set SafeItem = Nothing
Set SafeContact = Nothing

End Sub
 

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

Top