P
pierre
In the help they say to paste this code (under the ----) into a class module
Now that it is done:
What is the name of the class i just create? Myolitems?
How can i declare or call it from a regular module
MS say in the help that the code won't work unitl you initialise_handler
How can i do that?
I try
Dim oi as myOlitems
and
oi.initialise_handler from a regular module but it is not working.
Can someone help Me?
Regards, pierre
-----------------------------------------------------------------------
Dim myOlApp As Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Initialize_handler()
Set myOlItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim myOlMItem As Outlook.MailItem
Dim myOlAtts As Outlook.Attachments
Set myOlMItem = myOlApp.CreateItem(olMailItem)
myOlMItem.Save
Set myOlAtts = myOlMItem.Attachments
' Add new contact to attachments in mail message
myOlAtts.Add Item, olByValue
myOlMItem.To = "Sales Team"
myOlMItem.Subject = "New contact"
myOlMItem.Send
End Sub
..
Now that it is done:
What is the name of the class i just create? Myolitems?
How can i declare or call it from a regular module
MS say in the help that the code won't work unitl you initialise_handler
How can i do that?
I try
Dim oi as myOlitems
and
oi.initialise_handler from a regular module but it is not working.
Can someone help Me?
Regards, pierre
-----------------------------------------------------------------------
Dim myOlApp As Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Initialize_handler()
Set myOlItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim myOlMItem As Outlook.MailItem
Dim myOlAtts As Outlook.Attachments
Set myOlMItem = myOlApp.CreateItem(olMailItem)
myOlMItem.Save
Set myOlAtts = myOlMItem.Attachments
' Add new contact to attachments in mail message
myOlAtts.Add Item, olByValue
myOlMItem.To = "Sales Team"
myOlMItem.Subject = "New contact"
myOlMItem.Send
End Sub
..