A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

how to make this code work



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old June 13th 06, 03:34 PM posted to microsoft.public.outlook.program_vba
pierre
external usenet poster
 
Posts: 2
Default how to make this code work

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(olFo lderContacts).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

..
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can I color code tasks with a category or otherwise make subcatego Arthur Outlook - Using Contacts 1 April 24th 06 12:37 AM
new internet carrier & I can't make outlook work Quinton567 Outlook - General Queries 4 February 8th 06 12:57 AM
How Do I make all this work? bnichols9 Outlook - General Queries 1 February 7th 06 01:48 AM
Saving as a Template means code doesn't work Michael Anderson Outlook - Using Forms 1 January 19th 06 05:22 PM
How to Make Distribution Lists Work Properly Bernie Outlook and VBA 0 January 10th 06 07:34 PM


All times are GMT +1. The time now is 06:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.