Email For Selected Contacts

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
One more important question!!!! Given all you have shown me and what I have updated, and now have the code that does things for the selected contacts in different areas. And in a number of folder I don't need to create a distribution list as can change each day. So I created the following code that creates an email for all contacts selected but it only uses the email of the first selected contact....so what can we change quickly so it adds the email address per each selected contact to the email of the selected contacts etc.. This would be great as well!!! Sub EmailTest()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As MailItem
Dim objItem As Object

Set oContact = GetCurrentItem()
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection

For Each objItem In objSelection


Set objMsg = Application.CreateItemFromTemplate("C:\Users\Name\AppData\Roaming\Microsoft\Templates\E-mailForm.oft")
With objMsg
.To = oContact.Email1Address
objMsg.Display
End With

Next
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing

End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I just found the way to do this where I select a list of contacts, and it creates an email to each one.....and you can have it displayed or sent as you will see the options below as well.Sub EmailTest1()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As MailItem
Dim objItem As Object

Set oContact = objItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection

For Each objItem In objSelection


Set objMsg = Application.CreateItemFromTemplate("C:\Users\Name\AppData\Roaming\Microsoft\Templates\E-mailForm.oft")
With objMsg
.To = objItem.Email1Address

'objMsg.Send
objMsg.Display
End With

Next
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing

End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Is there a way to change the code above so when I select the contacts, it runs the script that is in the contact that is named Sub btntasks_click and the name of the commandbutton in the contact is btntasks?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Any update for this tonight?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
To All: This is the code I worked thru where I used the script code from the contact form to create a macro in a module, that when I select a list of contacts, it creates a task to each one based on the date in field of each contact: Sub Group_Create_Task()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As MailItem
Dim objItem As Object
Dim remoteObj
Dim StartDate
Dim DueDate

Dim myItem

Set oContact = objItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection

For Each objItem In objSelection

Set myItem = Application.CreateItemFromTemplate("C:\Users\Name\AppData\Roaming\Microsoft\Templates\Task Follow-Up.oft")

myItem.Display

StartDate = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl4").value

DueDate = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl3").value

myItem.StartDate = StartDate

myItem.DueDate = DueDate

myItem.Links.Add objItem
Next
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing

End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
G Autocomplete adds suspicious "@unknown.email" to selected contacts Using Outlook 1
P Is it possible to write a macro to email to all addresses of selected contacts? Using Outlook 1
R VBA Code to permanently delete selected email Outlook VBA and Custom Forms 10
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
Diane Poremsky Save Selected Email Message as .msg File New Slipstick.com Articles 11
I Save selected email message as .msg file (with user to choose folder location) Outlook VBA and Custom Forms 14
D Trigger macro to run when selected email is opened Using Outlook 3
C Can't see new email in inbox until view is changed or another folder is selected. Using Outlook 2
N WINDOWNS LIVE SETTINGS / ADVANCED / REPLY E-MAIL (does not reply to email selected) Using Outlook 3
W September 2020 - No Default Email Client message after Office Update Using Outlook 1
glnz O365 - How to combine the Inboxes for four email accounts into a single Inbox Using Outlook 7
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 1
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
E Asking user to select multiple options in a list in an email Outlook VBA and Custom Forms 0
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
B Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
A Backup Email Accounts On OutLook For Mac 2016 (Microsoft 365 subscription version) Using Outlook 0
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
G Inbox shows old email Using Outlook 3
L Email with correct To address but displaying name of a related person Using Outlook 0
A Two Inboxes, Same Email? Using Outlook 3
B Adding signature to bottom of VBA reply email Outlook VBA and Custom Forms 1
J To delete the draft email Using Outlook 2
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
D Sending email from Office 365 alias in Outlook Using Outlook 3
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 3
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
R Outlook 2010 How do you export 2 email Accounts' 2010 Inbox Files to new computer (2019)? Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
J Automatically forward email and apply template Outlook VBA and Custom Forms 0
L Outlook saved email templates Using Outlook 1
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
T How can you include Junk Email in Search Results like you can include Deleted Items? Using Outlook 3
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
W Replyin to the reply-to email address Outlook VBA and Custom Forms 0
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
M Extract all links from Outlook email, send to Excel Using Outlook 2
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
T The non-email functions Using Outlook 8
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
C How to rename subject line and forward the email Outlook VBA and Custom Forms 2
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
Similar threads


















































Top