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.
Similar threads
Thread starter Title 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
Bering Forward selected email without the original email appended Outlook VBA and Custom Forms 0
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
M HTML email signature in Outlook Using Outlook 1
M Respond to Outlook Email Outlook VBA and Custom Forms 0
U Outlook locking up when replying to Email Using Outlook 7
S Email Generated from another program and then edited sends original email. Using Outlook 2
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
S Unable to extract text from an Outlook email message Using Outlook 2
T Original email text not shown when replying or forwarding the email. Using Outlook 6
H Search Email Header for Content Type Outlook VBA and Custom Forms 1
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
P How did hacker cause link to delete and archive containing email? Using Outlook 6
I 'quote marks' around email name Using Outlook 1
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
T Junk Email does not get added to the Blocked Sender List Using Outlook 0
P i-Phone 6s Plus receiving 2 notifications from Outlook email Using Outlook 1
C WARNING - DO NOT USE AN OUTLOOK.COM ADDRESS FOR GOOGLE ACCOUNT RECOVERY EMAIL Using Outlook 10
T Why is every new email pinned (to keep it on top)? Windows 10 Using Outlook 6
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
P Can I create a Rule that sends me an email when I get a Task? Using Outlook 3
M Issue transferring Outlook 2016 email accounts & settings onto new computer Using Outlook 8
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
S Outlook email to configure setup for each mail Outlook VBA and Custom Forms 1
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
M How create a Rule to filter sender's email with more that one @ sign Using Outlook 1
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
W Reply to email Using Outlook 4
F Junk Email does not get added to the Blocked Sender List Using Outlook 4
B disappearing original when attach to email Using Outlook 1
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 0
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

Similar threads

Top