| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
You don't need to select the folders at all. If all you want is to create a
new Contact from all incoming messages and save it in the default Contacts folder, you can do so by pasting this code into your ThisOutlookSession module in the Outlook VBA Editor: Option Explicit Dim WithEvents NewMailItems As Outlook.Items Private Sub Application_Startup() Set NewMailItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items End Sub Private Sub NewMailItems_ItemAdd(ByVal Item As Object) 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE Dim objContact As Outlook.ContactItem Dim objMsg As Outlook.MailItem If Item.Class <> olMail Then Exit Sub Set objContact = Application.CreateItem(olContactItem) Set objMsg = Item objContact.FullName = objMsg.SenderName objContact.Email1Address = objMsg.SenderEmailAddress objContact.Save Set objContact = Nothing Set objMsg = Nothing End Sub Note that the ItemAdd event is not guaranteed to fire if a large number of messages are delivered at once. Also, if you do not have Outlook 2003 a security warning will pop up when the code tries to access the SenderEmailAddress property. For ways to bypass this, see: Microsoft Outlook "Object Model Guard" Security Issues for Developers: http://www.outlookcode.com/d/sec.htm And for some great starting resources on Outlook programming, see: Visual Basic and VBA Coding in Microsoft Outlook: http://www.outlookcode.com/d/vb.htm -- Eric Legault - B.A, MCP, MCSD, Outlook MVP Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "Brent E" wrote: > Good morning, > > I am really new to VBA for Outlook. I am trying to create a macro/module > that will: > Automatically select the contacts folder, > Select Inbox titled "Realtor.com" > Create a contact from each email that comes into this Inbox. > I am not sure what commands or syntax to use. Would this be a simple > program? Suggestions would be really appreciated. Thanks. > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?QnJlbnQgRQ==?=
Guest
Posts: n/a
|
Sounds Magnificent. I really appreciate your assitance, Eric. I am also
running 2003 and am curious. I've pasted these procedures into my ThisOutlookSession module and restarted Outlook, but this won't seem to run automatcially, what command should I use to launch this? I tried lookin in my macros window but was blank. I also thought of running these procedures name from the Immediate window in the VBE, but I get an error saying "Macros not enabled in this project". Also, this is basically what I am trying to get to: a module that will do the following: I've got 3 Inboxes setup which get email from 3 different sources. These Inboxes are named "ERealty", "Realtor.com" and "Website" I need to create contacts from all emails in each Inbox and save these contacts in corresponding Outlook contact folders, named similarly (e.g. "ERealty", "Realtor.com" and "Website") So we have Inboxes and Contact Folders w/ these names. These Inboxes and Contact folders are already created and in place. So I need to create a module that will automatically generate contacts from each Inbox and save them in their proper Contact folder. ? I really appreciate your assistance "Eric Legault [MVP - Outlook]" wrote: > You don't need to select the folders at all. If all you want is to create a > new Contact from all incoming messages and save it in the default Contacts > folder, you can do so by pasting this code into your ThisOutlookSession > module in the Outlook VBA Editor: > > Option Explicit > Dim WithEvents NewMailItems As Outlook.Items > > Private Sub Application_Startup() > Set NewMailItems = > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > End Sub > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > Dim objContact As Outlook.ContactItem > Dim objMsg As Outlook.MailItem > > If Item.Class <> olMail Then Exit Sub > > Set objContact = Application.CreateItem(olContactItem) > Set objMsg = Item > > objContact.FullName = objMsg.SenderName > objContact.Email1Address = objMsg.SenderEmailAddress > objContact.Save > > Set objContact = Nothing > Set objMsg = Nothing > End Sub > > Note that the ItemAdd event is not guaranteed to fire if a large number of > messages are delivered at once. Also, if you do not have Outlook 2003 a > security warning will pop up when the code tries to access the > SenderEmailAddress property. For ways to bypass this, see: > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > http://www.outlookcode.com/d/sec.htm > > And for some great starting resources on Outlook programming, see: > > Visual Basic and VBA Coding in Microsoft Outlook: > http://www.outlookcode.com/d/vb.htm > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > "Brent E" wrote: > > > Good morning, > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > that will: > > Automatically select the contacts folder, > > Select Inbox titled "Realtor.com" > > Create a contact from each email that comes into this Inbox. > > I am not sure what commands or syntax to use. Would this be a simple > > program? Suggestions would be really appreciated. Thanks. > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
You need to change your macro security settings to Medium or lower to run
macros. Do you want these Contacts created only when e-mails are received in your Inbox, or moved to those sub-folders? Or do you need to create them in one shot as a batch, running the batch once for every folder containing the e-mails? -- Eric Legault - B.A, MCP, MCSD, Outlook MVP Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "Brent E" wrote: > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > running 2003 and am curious. I've pasted these procedures into my > ThisOutlookSession module and restarted Outlook, but this won't seem to run > automatcially, what command should I use to launch this? I tried lookin in my > macros window but was blank. I also thought of running these procedures name > from the Immediate window in the VBE, but I get an error saying "Macros not > enabled in this project". > > Also, this is basically what I am trying to get to: a module that will do > the following: > I've got 3 Inboxes setup which get email from 3 different sources. > These Inboxes are named "ERealty", "Realtor.com" and "Website" > I need to create contacts from all emails in each Inbox and save these > contacts in corresponding Outlook contact folders, named similarly (e.g. > "ERealty", "Realtor.com" and "Website") > So we have Inboxes and Contact Folders w/ these names. > These Inboxes and Contact folders are already created and in place. > So I need to create a module that will automatically generate contacts from > each Inbox and save them in their proper Contact folder. ? I really > appreciate your assistance > > "Eric Legault [MVP - Outlook]" wrote: > > > You don't need to select the folders at all. If all you want is to create a > > new Contact from all incoming messages and save it in the default Contacts > > folder, you can do so by pasting this code into your ThisOutlookSession > > module in the Outlook VBA Editor: > > > > Option Explicit > > Dim WithEvents NewMailItems As Outlook.Items > > > > Private Sub Application_Startup() > > Set NewMailItems = > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > End Sub > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > Dim objContact As Outlook.ContactItem > > Dim objMsg As Outlook.MailItem > > > > If Item.Class <> olMail Then Exit Sub > > > > Set objContact = Application.CreateItem(olContactItem) > > Set objMsg = Item > > > > objContact.FullName = objMsg.SenderName > > objContact.Email1Address = objMsg.SenderEmailAddress > > objContact.Save > > > > Set objContact = Nothing > > Set objMsg = Nothing > > End Sub > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > security warning will pop up when the code tries to access the > > SenderEmailAddress property. For ways to bypass this, see: > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > http://www.outlookcode.com/d/sec.htm > > > > And for some great starting resources on Outlook programming, see: > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > http://www.outlookcode.com/d/vb.htm > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > "Brent E" wrote: > > > > > Good morning, > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > that will: > > > Automatically select the contacts folder, > > > Select Inbox titled "Realtor.com" > > > Create a contact from each email that comes into this Inbox. > > > I am not sure what commands or syntax to use. Would this be a simple > > > program? Suggestions would be really appreciated. Thanks. > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?QnJlbnQgRQ==?=
Guest
Posts: n/a
|
Sorry for the delay in getting back to you, meeting this morning and working
on this response for a while. LOL. OK cool, I will change my macro security setting to Medium or lower; hopefully I will be able To answer your question. Currently the emails are setup by a rule. Emails come into 3 seperate Inboxes depending on their source: "ERealty" Inbox, "Realtor.com" Inbox and "Website" Inbox. This seems to be working, but we need a module that will take each email (can do all Inboxes at once or seperately) and generate a contact in their corresponding Contact folders (e.g. Emails from "ERealty" Inbox create a contact in "ERealty" contact folder; "Realtor.com Inbox emails create a contact in "Realtor.com" Contact folder, etc.) But I think your question's more in regards to when contacts should be made, correct? I think would probably be better if we could set these up to generate contacts in a batch (that I can run once or twice a day) Could be one Inbox at a time (or all Inboxes at same time, whichever is easier). I know this may be a round-about way to do this but what I am trying to do is this: Goal: Get a csv file (from each source/Inbox) w/ full names and email address from all emails that come into the Inbox. To do this what I am thinking is to basically take all emails from each source (e.g each Inbox), pull out their full name and email address from the email, and create a contact from this, then I can export all contacts from a specific contact folder to a csv file containing the full names and email address of all emails that came into the Inbox. Then I can import this csv list to another program. I also notice that the program I am importing to will not overwrite a contact so if the list of contacts contains the same contact the second time, there will be duplicates . So I need to maybe once or twice a day, pull all the names and email addresses from a specfiic Inbox, generate a csv file w/ these names and email address (via creating a Outlook contact first as intermediate step), then move these contacts to a Archive folder (by source name, e.g. ERealty, etc. to keep them sorted by source) Then the next time I run the program, the contacts list only includes contacts that came in since the last time I ran the program. Then there will be no duplicates of old data when I Import to another program. Now I've probably thoroughly confused you. LOL. Let me know if this didn't make sense. Basically I just need a module to take emails from each Inbox and create contacts from all emails currently in the Inbox. (I can manually archive these and export them to a csv file if easier to do manually then in a module . What do you think? Thanks again for your assistance."Eric Legault [MVP - Outlook]" wrote: > You need to change your macro security settings to Medium or lower to run > macros. > > Do you want these Contacts created only when e-mails are received in your > Inbox, or moved to those sub-folders? Or do you need to create them in one > shot as a batch, running the batch once for every folder containing the > e-mails? > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > "Brent E" wrote: > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > running 2003 and am curious. I've pasted these procedures into my > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > automatcially, what command should I use to launch this? I tried lookin in my > > macros window but was blank. I also thought of running these procedures name > > from the Immediate window in the VBE, but I get an error saying "Macros not > > enabled in this project". > > > > Also, this is basically what I am trying to get to: a module that will do > > the following: > > I've got 3 Inboxes setup which get email from 3 different sources. > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > I need to create contacts from all emails in each Inbox and save these > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > "ERealty", "Realtor.com" and "Website") > > So we have Inboxes and Contact Folders w/ these names. > > These Inboxes and Contact folders are already created and in place. > > So I need to create a module that will automatically generate contacts from > > each Inbox and save them in their proper Contact folder. ? I really > > appreciate your assistance > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > You don't need to select the folders at all. If all you want is to create a > > > new Contact from all incoming messages and save it in the default Contacts > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > module in the Outlook VBA Editor: > > > > > > Option Explicit > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > Private Sub Application_Startup() > > > Set NewMailItems = > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > End Sub > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > Dim objContact As Outlook.ContactItem > > > Dim objMsg As Outlook.MailItem > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > Set objMsg = Item > > > > > > objContact.FullName = objMsg.SenderName > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > objContact.Save > > > > > > Set objContact = Nothing > > > Set objMsg = Nothing > > > End Sub > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > security warning will pop up when the code tries to access the > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > http://www.outlookcode.com/d/sec.htm > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > http://www.outlookcode.com/d/vb.htm > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > "Brent E" wrote: > > > > > > > Good morning, > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > that will: > > > > Automatically select the contacts folder, > > > > Select Inbox titled "Realtor.com" > > > > Create a contact from each email that comes into this Inbox. > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Brent, try the code below. I'm in a hurry to go somewhere right now, so ping
me again later if you need clarification: Sub BatchContactImport() Dim objNS As Outlook.NameSpace Dim objMailFolder As Outlook.MAPIFolder, objContactsFolder As Outlook.MAPIFolder Set objNS = Application.GetNamespace("MAPI") MsgBox "With the next dialog, choose the mail folder that contains the messages you want to " _ & "extract Contact data from...", vbOKOnly + vbInformation, "Choose Mail Folder" Set objMailFolder = objNS.PickFolder If objMailFolder Is Nothing Then Exit Sub MsgBox "With the next dialog, choose the Contact folder where you want to import the Contacts into..." _ , vbOKOnly + vbInformation, "Choose Contacts Folder" Set objContactsFolder = objNS.PickFolder If objContactsFolder Is Nothing Then Exit Sub ImportContacts objMailFolder, objContactsFolder End Sub Sub ImportContacts(MailFolder As Outlook.MAPIFolder, ContactsFolder As Outlook.MAPIFolder) On Error Resume Next Dim objContact As Outlook.ContactItem Dim objItems As Outlook.Items, objItem As Object Dim objItemsSearch As Outlook.Items Set objItems = MailFolder.Items For Each objItem In objItems If objItem.Class = olMail Then Set objContact = ContactsFolder.Items.Add(olContactItem) objContact.FullName = objItem.SenderName objContact.Email1Address = objItem.SenderEmailAddress Set objItemsSearch = ContactsFolder.Items.Restrict("[FullName] = '" & objContact.FullName & "'") If objItemsSearch.Count = 0 Then 'Contact doesn't exist objContact.Save End If Set objContact = Nothing End If Next Set objItem = Nothing Set objItems = Nothing End Sub -- Eric Legault - B.A, MCP, MCSD, Outlook MVP Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "Brent E" wrote: > Sorry for the delay in getting back to you, meeting this morning and working > on this response for a while. LOL. > > OK cool, I will change my macro security setting to Medium or lower; > hopefully I will be able To answer your question. > Currently the emails are setup by a rule. Emails come into 3 seperate > Inboxes depending on their source: "ERealty" Inbox, "Realtor.com" Inbox and > "Website" Inbox. This seems to be working, but we need a module that will > take each email (can do all Inboxes at once or seperately) and generate a > contact in their corresponding Contact folders (e.g. Emails from "ERealty" > Inbox create a contact in "ERealty" contact folder; "Realtor.com Inbox emails > create a contact in "Realtor.com" Contact folder, etc.) > But I think your question's more in regards to when contacts should be made, > correct? I think would probably be better if we could set these up to > generate contacts in a batch (that I can run once or twice a day) Could be > one Inbox at a time (or all Inboxes at same time, whichever is easier). I > know this may be a round-about way to do this but what I am trying to do is > this: > > Goal: Get a csv file (from each source/Inbox) w/ full names and email > address from all emails that come into the Inbox. > > To do this what I am thinking is to basically take all emails from each > source (e.g each Inbox), pull out their full name and email address from the > email, and create a contact from this, then I can export all contacts from a > specific contact folder to a csv file containing the full names and email > address of all emails that came into the Inbox. Then I can import this csv > list to another program. > I also notice that the program I am importing to will not overwrite a > contact so if the list of contacts contains the same contact the second time, > there will be duplicates . So I need to maybe once or twice a day, pull all > the names and email addresses from a specfiic Inbox, generate a csv file w/ > these names and email address (via creating a Outlook contact first as > intermediate step), then move these contacts to a Archive folder (by source > name, e.g. ERealty, etc. to keep them sorted by source) Then the next time I > run the program, the contacts list only includes contacts that came in since > the last time I ran the program. Then there will be no duplicates of old data > when I Import to another program. Now I've probably thoroughly confused you. > LOL. Let me know if this didn't make sense. > > Basically I just need a module to take emails from each Inbox and create > contacts from all emails currently in the Inbox. (I can manually archive > these and export them to a csv file if easier to do manually then in a > module . What do you think? Thanks again for your assistance.> > "Eric Legault [MVP - Outlook]" wrote: > > > You need to change your macro security settings to Medium or lower to run > > macros. > > > > Do you want these Contacts created only when e-mails are received in your > > Inbox, or moved to those sub-folders? Or do you need to create them in one > > shot as a batch, running the batch once for every folder containing the > > e-mails? > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > "Brent E" wrote: > > > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > > running 2003 and am curious. I've pasted these procedures into my > > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > > automatcially, what command should I use to launch this? I tried lookin in my > > > macros window but was blank. I also thought of running these procedures name > > > from the Immediate window in the VBE, but I get an error saying "Macros not > > > enabled in this project". > > > > > > Also, this is basically what I am trying to get to: a module that will do > > > the following: > > > I've got 3 Inboxes setup which get email from 3 different sources. > > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > > I need to create contacts from all emails in each Inbox and save these > > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > > "ERealty", "Realtor.com" and "Website") > > > So we have Inboxes and Contact Folders w/ these names. > > > These Inboxes and Contact folders are already created and in place. > > > So I need to create a module that will automatically generate contacts from > > > each Inbox and save them in their proper Contact folder. ? I really > > > appreciate your assistance > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > You don't need to select the folders at all. If all you want is to create a > > > > new Contact from all incoming messages and save it in the default Contacts > > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > > module in the Outlook VBA Editor: > > > > > > > > Option Explicit > > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > > > Private Sub Application_Startup() > > > > Set NewMailItems = > > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > > End Sub > > > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > > > Dim objContact As Outlook.ContactItem > > > > Dim objMsg As Outlook.MailItem > > > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > > Set objMsg = Item > > > > > > > > objContact.FullName = objMsg.SenderName > > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > > objContact.Save > > > > > > > > Set objContact = Nothing > > > > Set objMsg = Nothing > > > > End Sub > > > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > > security warning will pop up when the code tries to access the > > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > > http://www.outlookcode.com/d/sec.htm > > > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > > http://www.outlookcode.com/d/vb.htm > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "Brent E" wrote: > > > > > > > > > Good morning, > > > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > > that will: > > > > > Automatically select the contacts folder, > > > > > Select Inbox titled "Realtor.com" > > > > > Create a contact from each email that comes into this Inbox. > > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RkxTdXNhbkM=?=
Guest
Posts: n/a
|
I wonder if this would accomplish the same for my needs: for every person
that wants to be added to our mailing list and completes the "join our mailing list" form on the website, the infomation will automatically be added as a new contact in Outlook. Would it be smarter to use a separate contact folder or use a category to filter them later? Thank you for your advise. "Eric Legault [MVP - Outlook]" wrote: > You need to change your macro security settings to Medium or lower to run > macros. > > Do you want these Contacts created only when e-mails are received in your > Inbox, or moved to those sub-folders? Or do you need to create them in one > shot as a batch, running the batch once for every folder containing the > e-mails? > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > "Brent E" wrote: > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > running 2003 and am curious. I've pasted these procedures into my > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > automatcially, what command should I use to launch this? I tried lookin in my > > macros window but was blank. I also thought of running these procedures name > > from the Immediate window in the VBE, but I get an error saying "Macros not > > enabled in this project". > > > > Also, this is basically what I am trying to get to: a module that will do > > the following: > > I've got 3 Inboxes setup which get email from 3 different sources. > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > I need to create contacts from all emails in each Inbox and save these > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > "ERealty", "Realtor.com" and "Website") > > So we have Inboxes and Contact Folders w/ these names. > > These Inboxes and Contact folders are already created and in place. > > So I need to create a module that will automatically generate contacts from > > each Inbox and save them in their proper Contact folder. ? I really > > appreciate your assistance > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > You don't need to select the folders at all. If all you want is to create a > > > new Contact from all incoming messages and save it in the default Contacts > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > module in the Outlook VBA Editor: > > > > > > Option Explicit > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > Private Sub Application_Startup() > > > Set NewMailItems = > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > End Sub > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > Dim objContact As Outlook.ContactItem > > > Dim objMsg As Outlook.MailItem > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > Set objMsg = Item > > > > > > objContact.FullName = objMsg.SenderName > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > objContact.Save > > > > > > Set objContact = Nothing > > > Set objMsg = Nothing > > > End Sub > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > security warning will pop up when the code tries to access the > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > http://www.outlookcode.com/d/sec.htm > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > http://www.outlookcode.com/d/vb.htm > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > "Brent E" wrote: > > > > > > > Good morning, > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > that will: > > > > Automatically select the contacts folder, > > > > Select Inbox titled "Realtor.com" > > > > Create a contact from each email that comes into this Inbox. > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Wow, an old thread resurrected! :-)
It depends on how this form is processed on your web site. Do the results get sent to someone internally via e-mail? -- Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "FLSusanC" wrote: > I wonder if this would accomplish the same for my needs: for every person > that wants to be added to our mailing list and completes the "join our > mailing list" form on the website, the infomation will automatically be added > as a new contact in Outlook. Would it be smarter to use a separate contact > folder or use a category to filter them later? > Thank you for your advise. > > "Eric Legault [MVP - Outlook]" wrote: > > > You need to change your macro security settings to Medium or lower to run > > macros. > > > > Do you want these Contacts created only when e-mails are received in your > > Inbox, or moved to those sub-folders? Or do you need to create them in one > > shot as a batch, running the batch once for every folder containing the > > e-mails? > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > "Brent E" wrote: > > > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > > running 2003 and am curious. I've pasted these procedures into my > > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > > automatcially, what command should I use to launch this? I tried lookin in my > > > macros window but was blank. I also thought of running these procedures name > > > from the Immediate window in the VBE, but I get an error saying "Macros not > > > enabled in this project". > > > > > > Also, this is basically what I am trying to get to: a module that will do > > > the following: > > > I've got 3 Inboxes setup which get email from 3 different sources. > > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > > I need to create contacts from all emails in each Inbox and save these > > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > > "ERealty", "Realtor.com" and "Website") > > > So we have Inboxes and Contact Folders w/ these names. > > > These Inboxes and Contact folders are already created and in place. > > > So I need to create a module that will automatically generate contacts from > > > each Inbox and save them in their proper Contact folder. ? I really > > > appreciate your assistance > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > You don't need to select the folders at all. If all you want is to create a > > > > new Contact from all incoming messages and save it in the default Contacts > > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > > module in the Outlook VBA Editor: > > > > > > > > Option Explicit > > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > > > Private Sub Application_Startup() > > > > Set NewMailItems = > > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > > End Sub > > > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > > > Dim objContact As Outlook.ContactItem > > > > Dim objMsg As Outlook.MailItem > > > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > > Set objMsg = Item > > > > > > > > objContact.FullName = objMsg.SenderName > > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > > objContact.Save > > > > > > > > Set objContact = Nothing > > > > Set objMsg = Nothing > > > > End Sub > > > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > > security warning will pop up when the code tries to access the > > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > > http://www.outlookcode.com/d/sec.htm > > > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > > http://www.outlookcode.com/d/vb.htm > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "Brent E" wrote: > > > > > > > > > Good morning, > > > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > > that will: > > > > > Automatically select the contacts folder, > > > > > Select Inbox titled "Realtor.com" > > > > > Create a contact from each email that comes into this Inbox. > > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RkxTdXNhbkM=?=
Guest
Posts: n/a
|
Currently contact information is entered when people donate monies thru the
link on our site using PayPal. I will have to check with the Web designer to be sure. What will need to happen? Have you heard of the Constant Contact program? "Eric Legault [MVP - Outlook]" wrote: > Wow, an old thread resurrected! :-) > > It depends on how this form is processed on your web site. Do the results > get sent to someone internally via e-mail? > > -- > Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) > Try Picture Attachments Wizard for Outlook: > http://www.collaborativeinnovations.ca > Blog: http://blogs.officezealot.com/legault/ > > > "FLSusanC" wrote: > > > I wonder if this would accomplish the same for my needs: for every person > > that wants to be added to our mailing list and completes the "join our > > mailing list" form on the website, the infomation will automatically be added > > as a new contact in Outlook. Would it be smarter to use a separate contact > > folder or use a category to filter them later? > > Thank you for your advise. > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > You need to change your macro security settings to Medium or lower to run > > > macros. > > > > > > Do you want these Contacts created only when e-mails are received in your > > > Inbox, or moved to those sub-folders? Or do you need to create them in one > > > shot as a batch, running the batch once for every folder containing the > > > e-mails? > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > "Brent E" wrote: > > > > > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > > > running 2003 and am curious. I've pasted these procedures into my > > > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > > > automatcially, what command should I use to launch this? I tried lookin in my > > > > macros window but was blank. I also thought of running these procedures name > > > > from the Immediate window in the VBE, but I get an error saying "Macros not > > > > enabled in this project". > > > > > > > > Also, this is basically what I am trying to get to: a module that will do > > > > the following: > > > > I've got 3 Inboxes setup which get email from 3 different sources. > > > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > > > I need to create contacts from all emails in each Inbox and save these > > > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > > > "ERealty", "Realtor.com" and "Website") > > > > So we have Inboxes and Contact Folders w/ these names. > > > > These Inboxes and Contact folders are already created and in place. > > > > So I need to create a module that will automatically generate contacts from > > > > each Inbox and save them in their proper Contact folder. ? I really > > > > appreciate your assistance > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > You don't need to select the folders at all. If all you want is to create a > > > > > new Contact from all incoming messages and save it in the default Contacts > > > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > > > module in the Outlook VBA Editor: > > > > > > > > > > Option Explicit > > > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > > > > > Private Sub Application_Startup() > > > > > Set NewMailItems = > > > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > > > End Sub > > > > > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > > > > > Dim objContact As Outlook.ContactItem > > > > > Dim objMsg As Outlook.MailItem > > > > > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > > > Set objMsg = Item > > > > > > > > > > objContact.FullName = objMsg.SenderName > > > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > > > objContact.Save > > > > > > > > > > Set objContact = Nothing > > > > > Set objMsg = Nothing > > > > > End Sub > > > > > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > > > security warning will pop up when the code tries to access the > > > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > > > http://www.outlookcode.com/d/sec.htm > > > > > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > > > http://www.outlookcode.com/d/vb.htm > > > > > > > > > > -- > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > > > Job: http://www.imaginets.com > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > "Brent E" wrote: > > > > > > > > > > > Good morning, > > > > > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > > > that will: > > > > > > Automatically select the contacts folder, > > > > > > Select Inbox titled "Realtor.com" > > > > > > Create a contact from each email that comes into this Inbox. > > > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > > > > > Cordially, |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Ultimately you need that web form to send an e-mail to someone internally.
This e-mail would contain the e-mail address of the user who submitted the form somewhere - in the subject or message body. The macro I wrote earlier in this thread would be perfect to auto-create Contacts based on these incoming e-mails, however it would have to be tweaked to parse the subject line or message body to read the user e-mail, and it would not be coming from the user (the e-mail would be coming from whatever e-mail account was used on the web server to send that internal e-mail). The macro would also need to run on the computer that is running the Outlook profile connected to the e-mail account that receives the results of the web forms. -- Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "FLSusanC" wrote: > Currently contact information is entered when people donate monies thru the > link on our site using PayPal. I will have to check with the Web designer to > be sure. > > What will need to happen? > Have you heard of the Constant Contact program? > > "Eric Legault [MVP - Outlook]" wrote: > > > Wow, an old thread resurrected! :-) > > > > It depends on how this form is processed on your web site. Do the results > > get sent to someone internally via e-mail? > > > > -- > > Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) > > Try Picture Attachments Wizard for Outlook: > > http://www.collaborativeinnovations.ca > > Blog: http://blogs.officezealot.com/legault/ > > > > > > "FLSusanC" wrote: > > > > > I wonder if this would accomplish the same for my needs: for every person > > > that wants to be added to our mailing list and completes the "join our > > > mailing list" form on the website, the infomation will automatically be added > > > as a new contact in Outlook. Would it be smarter to use a separate contact > > > folder or use a category to filter them later? > > > Thank you for your advise. > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > You need to change your macro security settings to Medium or lower to run > > > > macros. > > > > > > > > Do you want these Contacts created only when e-mails are received in your > > > > Inbox, or moved to those sub-folders? Or do you need to create them in one > > > > shot as a batch, running the batch once for every folder containing the > > > > e-mails? > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "Brent E" wrote: > > > > > > > > > Sounds Magnificent. I really appreciate your assitance, Eric. I am also > > > > > running 2003 and am curious. I've pasted these procedures into my > > > > > ThisOutlookSession module and restarted Outlook, but this won't seem to run > > > > > automatcially, what command should I use to launch this? I tried lookin in my > > > > > macros window but was blank. I also thought of running these procedures name > > > > > from the Immediate window in the VBE, but I get an error saying "Macros not > > > > > enabled in this project". > > > > > > > > > > Also, this is basically what I am trying to get to: a module that will do > > > > > the following: > > > > > I've got 3 Inboxes setup which get email from 3 different sources. > > > > > These Inboxes are named "ERealty", "Realtor.com" and "Website" > > > > > I need to create contacts from all emails in each Inbox and save these > > > > > contacts in corresponding Outlook contact folders, named similarly (e.g. > > > > > "ERealty", "Realtor.com" and "Website") > > > > > So we have Inboxes and Contact Folders w/ these names. > > > > > These Inboxes and Contact folders are already created and in place. > > > > > So I need to create a module that will automatically generate contacts from > > > > > each Inbox and save them in their proper Contact folder. ? I really > > > > > appreciate your assistance > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > > > You don't need to select the folders at all. If all you want is to create a > > > > > > new Contact from all incoming messages and save it in the default Contacts > > > > > > folder, you can do so by pasting this code into your ThisOutlookSession > > > > > > module in the Outlook VBA Editor: > > > > > > > > > > > > Option Explicit > > > > > > Dim WithEvents NewMailItems As Outlook.Items > > > > > > > > > > > > Private Sub Application_Startup() > > > > > > Set NewMailItems = > > > > > > Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items > > > > > > End Sub > > > > > > > > > > > > Private Sub NewMailItems_ItemAdd(ByVal Item As Object) > > > > > > 'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE > > > > > > 'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE > > > > > > > > > > > > Dim objContact As Outlook.ContactItem > > > > > > Dim objMsg As Outlook.MailItem > > > > > > > > > > > > If Item.Class <> olMail Then Exit Sub > > > > > > > > > > > > Set objContact = Application.CreateItem(olContactItem) > > > > > > Set objMsg = Item > > > > > > > > > > > > objContact.FullName = objMsg.SenderName > > > > > > objContact.Email1Address = objMsg.SenderEmailAddress > > > > > > objContact.Save > > > > > > > > > > > > Set objContact = Nothing > > > > > > Set objMsg = Nothing > > > > > > End Sub > > > > > > > > > > > > Note that the ItemAdd event is not guaranteed to fire if a large number of > > > > > > messages are delivered at once. Also, if you do not have Outlook 2003 a > > > > > > security warning will pop up when the code tries to access the > > > > > > SenderEmailAddress property. For ways to bypass this, see: > > > > > > > > > > > > Microsoft Outlook "Object Model Guard" Security Issues for Developers: > > > > > > http://www.outlookcode.com/d/sec.htm > > > > > > > > > > > > And for some great starting resources on Outlook programming, see: > > > > > > > > > > > > Visual Basic and VBA Coding in Microsoft Outlook: > > > > > > http://www.outlookcode.com/d/vb.htm > > > > > > > > > > > > -- > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > > Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm > > > > > > Job: http://www.imaginets.com > > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > > > "Brent E" wrote: > > > > > > > > > > > > > Good morning, > > > > > > > > > > > > > > I am really new to VBA for Outlook. I am trying to create a macro/module > > > > > > > that will: > > > > > > > Automatically select the contacts folder, > > > > > > > Select Inbox titled "Realtor.com" > > > > > > > Create a contact from each email that comes into this Inbox. > > > > > > > I am not sure what commands or syntax to use. Would this be a simple > > > > > > > program? Suggestions would be really appreciated. Thanks. > > > > > > > > > > > > > > Cordially, |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Possible to have two distinct sets of Contact in the one program? | David Probett | Microsoft Outlook Contacts | 2 | 8th Apr 2010 03:16 PM |
| Freeware Contact Manager program | Paige Miller | Freeware | 5 | 21st Jul 2005 03:19 PM |
| Program shut down after typing a name in the contact bar | =?Utf-8?B?Sm9l?= | Microsoft Outlook Contacts | 1 | 23rd Apr 2005 12:17 AM |
| How do I import my contact information from my ACT program into m. | =?Utf-8?B?U2hlcnJ5?= | Microsoft Outlook Contacts | 1 | 13th Dec 2004 11:56 PM |
| question about a contact sales program??? | Davef | Microsoft ASP .NET | 1 | 8th Aug 2003 09:46 AM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




