haystack47
MIS
I'm brand new to VBA and have taken on probably more than I can chew.
I'm looking to create VBA code to have Outlook 2000 send an e-mail only when an e-mail arrives in a certain folder. My folder is currently Inbox/Quarantine, but could/should be Deleted Items. I've found code to send the mail, but not to "watch" the Quarantine folder for incoming mail. Please see code I already have below.
Thanks,
haystack47
Sub EmailFromOutlookInExcel() 'macro name
Set myOlApp = CreateObject("Outlook.Application" 'opens Outlook
Set MailItem = myOlApp.CreateItem(olMailItem) ' opens new email
Set myRecipient = MailItem.Recipients.Add("recipient@company.com"'inserts recipient's email address
MailItem.Subject = "Subject of message goes here" 'subject of the email
Set myAttachments = MailItem.Attachments.Add("C:\foldername\filename"'Path To Attachments
'Repeat this line if there are more Atta
' chments
MailItem.Send'sends the email
End Sub
I'm looking to create VBA code to have Outlook 2000 send an e-mail only when an e-mail arrives in a certain folder. My folder is currently Inbox/Quarantine, but could/should be Deleted Items. I've found code to send the mail, but not to "watch" the Quarantine folder for incoming mail. Please see code I already have below.
Thanks,
haystack47
Sub EmailFromOutlookInExcel() 'macro name
Set myOlApp = CreateObject("Outlook.Application" 'opens Outlook
Set MailItem = myOlApp.CreateItem(olMailItem) ' opens new email
Set myRecipient = MailItem.Recipients.Add("recipient@company.com"'inserts recipient's email address
MailItem.Subject = "Subject of message goes here" 'subject of the email
Set myAttachments = MailItem.Attachments.Add("C:\foldername\filename"'Path To Attachments
'Repeat this line if there are more Atta
' chments
MailItem.Send'sends the email
End Sub