![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
I have the below code in a module that sets up an email, but I can't remember the code that sends it automatically. Does anyone know?
Sub OUTLOOK_collections_email() 'creates link to Outlook Dim objOL As New Outlook.Application Dim objMail As MailItem On Error Resume Next Set objOL = New Outlook.Application Set testsemail = objOL.createitem(olmailitem) 'sets characteristics for email With testsemail .ReadReciptRequested = False .To = "mail@mail.com" .Subject = "Subject" .Display .Body = "Blah Blah Blah" End With End Sub |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
.Send between the With and End with statements where you reference the testsemail Ivan |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
That doesnt work, it says "Invalid or unqualified reference"
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
It's cool, I had it in the wrong place
Thanks Ivan |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub OUTLOOK_collections_email() 'creates link to Outlook Dim objOL As New Outlook.Application Dim objMail As MailItem Dim testsemail On Error Resume Next Set objOL = New Outlook.Application Set testsemail = objOL.createitem(olmailitem) 'sets characteristics for email With testsemail .ReadReciptRequested = False .To = "mail@mail.com" .Subject = "Subject" .Display .Body = "Blah Blah Blah" .Send End With End Sub Ivan |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|