Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Running Outlook VB
How can I automate emails sent by triggering links within
Excel. I would like to send a standard email to various recipients when a date condition is met (actually an updated forecast). Do I need to buy and install VB6 or would I be able to run a programme in Excel that drives my Outlook? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Running Outlook VB
Bon Thank you. Could I run this from Excel vba? -----Original Message----- David, VBA can easily send mail via Outlook. Here is some example code Dim objOutlook As Object Dim objMailItem As Object Dim objRecipient As Object Dim objNameSpace As Object Set objOutlook = CreateObject ("Outlook.Application") Set objNameSpace = objOutlook.GetNameSpace ("MAPI") objNameSpace.Logon , , True Set objMailItem = objOutlook.CreateItem(0) Set objRecipient = objMailItem.Recipients.Add("bob.phillips@somewher e.com") objRecipient.Type = 1 '1 = To, use 2 for cc 'keep repeating these lines with 'your names, adding to the collection. objMailItem.Subject = "The extract has finished." objMailItem.Body = "This is an automatic email notification" objMailItem.Attachments.Add (Filename) 'you only need this if you are sending attachments? objMailItem.Send If you want to include an attachment as shown, it has to be a file not the activeworkbook, so if you want to send the activeworkbbok, save it firat, and then send it as that file. You can use 'ActiveWorkbook.FullName' to access it without using hard-coded values. You just will nedd to add the code to trigger the mailing. -- HTH Bob Phillips "David Robinson" wrote in message ... How can I automate emails sent by triggering links within Excel. I would like to send a standard email to various recipients when a date condition is met (actually an updated forecast). Do I need to buy and install VB6 or would I be able to run a programme in Excel that drives my Outlook? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Running Outlook VB
Does vba refer to the excel visual basic? -----Original Message----- David, VBA can easily send mail via Outlook. Here is some example code Dim objOutlook As Object Dim objMailItem As Object Dim objRecipient As Object Dim objNameSpace As Object Set objOutlook = CreateObject ("Outlook.Application") Set objNameSpace = objOutlook.GetNameSpace ("MAPI") objNameSpace.Logon , , True Set objMailItem = objOutlook.CreateItem(0) Set objRecipient = objMailItem.Recipients.Add("bob.phillips@somewher e.com") objRecipient.Type = 1 '1 = To, use 2 for cc 'keep repeating these lines with 'your names, adding to the collection. objMailItem.Subject = "The extract has finished." objMailItem.Body = "This is an automatic email notification" objMailItem.Attachments.Add (Filename) 'you only need this if you are sending attachments? objMailItem.Send If you want to include an attachment as shown, it has to be a file not the activeworkbook, so if you want to send the activeworkbbok, save it firat, and then send it as that file. You can use 'ActiveWorkbook.FullName' to access it without using hard-coded values. You just will nedd to add the code to trigger the mailing. -- HTH Bob Phillips "David Robinson" wrote in message ... How can I automate emails sent by triggering links within Excel. I would like to send a standard email to various recipients when a date condition is met (actually an updated forecast). Do I need to buy and install VB6 or would I be able to run a programme in Excel that drives my Outlook? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Outlook/Excel | Excel Worksheet Functions | |||
custimized outlook today in outlook 2007 | Excel Discussion (Misc queries) | |||
excel open in outlook if outlook is running | Excel Discussion (Misc queries) | |||
Send to Outlook 2000 not Outlook Express | Excel Discussion (Misc queries) | |||
Outlook 2003 demo back to Outlook XP | Excel Discussion (Misc queries) |