I created a very short SubProcedure, below, that ran fine at first. Once Outlook 2002 was closed and re-opened, it doesn't run and I get no error message.
I first wrote in in a new module, Module 1. Then I remmed that and pasted it into ThisOutlookSession and created a new toolbar button to run it. No Go.
What am I missing?
This procedure simply opens a new email message addressed to the currently selected Contact in the Contacts list. I was just about to write a line to check to make sure that the Contacts Explorer was active when it stopped working.
Option Explicit
Public Sub DansNewMessage()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim myItem As MailItem
Dim myRecipient As Recipient
Set myOlApp = CreateObject("Outlook.Application")
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add(myOlSel.Item(1))
myItem.Display
End Sub
Daniel Dillon
I first wrote in in a new module, Module 1. Then I remmed that and pasted it into ThisOutlookSession and created a new toolbar button to run it. No Go.
What am I missing?
This procedure simply opens a new email message addressed to the currently selected Contact in the Contacts list. I was just about to write a line to check to make sure that the Contacts Explorer was active when it stopped working.
Option Explicit
Public Sub DansNewMessage()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim myItem As MailItem
Dim myRecipient As Recipient
Set myOlApp = CreateObject("Outlook.Application")
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add(myOlSel.Item(1))
myItem.Display
End Sub
Daniel Dillon