Generating outlook tasks with populated data

  • Thread starter Thread starter Pepper
  • Start date Start date
P

Pepper

I was hoping to create a script that would create an task
and add some text that says: "Follow up on [pipeline]!
[Customer] deal with [pipeline]![Manufacturer]" as the
task title.

Is this possible?

Also any tips on the date? We currently only track the
week that the PO is supposed to come in, so I am assuming
that I would need to create a dlookup table to insert the
right follow up date. Is it possible to do a dlookup on 2
variables? We store Quarter in one field and Week
expected PO (Week 01 through Week 13) in another field.
 
Good Afternoon!

There are several ways to do this. One is shown below.
Make sure you have the reference to the Outlook Object
Library turned on. I am currently using Outlook 97 and
Access 97. I think the code would be the same in the newer
versions, but I am not positive.

Dim myMail As New Outlook.Application
Dim myTask As Outlook.TaskItem

Set myTask = myMail.CreateItem(olTaskItem)
myTask.Subject = "Follow up"
myTask.DueDate = #12/15/03#
myTask.Body = "Follow up on deal . . ."
myTask.Display

Set myMail = Nothing
Set myTask = Nothing

Good luck with your project!
 
I have seen quite a bit of code for sending email. I have
tried many of them. The one below( I have it stored as a
function) has been the most reliable for me with MS
Outlook. Also I am able to pull from an open form the
recipient, subject, text and attachment(s). Good Luck

Jim

Function SendEMail()
Dim strTo As String, strSubject As String, _
varBody As Variant, strCC As String, _
strBCC As String, strAttachment As String,
strAttachment1 As String

strTo = "email address"
strSubject = "put subject here"
varBody = "put message for body here"
' Add more strattachments if needed and modify IF statement
' below
strAttachment = "attachment1"
strAttachment1 = "attachment2"
'Start Outlook
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")

'Logon
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon

'Send a message
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
'Fill Out and Send Message
olMail.To = strTo
olMail.CC = strCC
olMail.BCC = strBCC
olMail.Subject = strSubject
olMail.Body = varBody
' Modify these statements if more attachmewnts are needed
If Len(strAttachment) <> 0 Then
olMail.Attachments.Add (strAttachment)
If Len(strAttachment1) <> 0 Then
olMail.Attachments.Add (strAttachment1)
End If
End If
olMail.Send

Set olNs = Nothing
Set olMail = Nothing
Set olApp = Nothing

End Function
 
How do I make sure that I have the reference to the
outlook object turned on?

I am guessing it is not because the code is not working

I get a "user define type not defined and this line is
highlighted in the debugger:

myMail As New Outlook.Application

Thanks!

-----Original Message-----
Good Afternoon!

There are several ways to do this. One is shown below.
Make sure you have the reference to the Outlook Object
Library turned on. I am currently using Outlook 97 and
Access 97. I think the code would be the same in the newer
versions, but I am not positive.

Dim myMail As New Outlook.Application
Dim myTask As Outlook.TaskItem

Set myTask = myMail.CreateItem(olTaskItem)
myTask.Subject = "Follow up"
myTask.DueDate = #12/15/03#
myTask.Body = "Follow up on deal . . ."
myTask.Display

Set myMail = Nothing
Set myTask = Nothing

Good luck with your project!
-----Original Message-----
I was hoping to create a script that would create an task
and add some text that says: "Follow up on [pipeline]!
[Customer] deal with [pipeline]![Manufacturer]" as the
task title.

Is this possible?

Also any tips on the date? We currently only track the
week that the PO is supposed to come in, so I am assuming
that I would need to create a dlookup table to insert the
right follow up date. Is it possible to do a dlookup on 2
variables? We store Quarter in one field and Week
expected PO (Week 01 through Week 13) in another field.

.
.
 
Good Evening!

Sorry it took me so long to reply. When you are in a
module, Click on the Tools Menu and then select
References. Scroll through the list until you see
something like Microsoft Outlook 8.0 . . . and then
click on the check box to turn on the reference.

-----Original Message-----
How do I make sure that I have the reference to the
outlook object turned on?

I am guessing it is not because the code is not working

I get a "user define type not defined and this line is
highlighted in the debugger:

myMail As New Outlook.Application

Thanks!

-----Original Message-----
Good Afternoon!

There are several ways to do this. One is shown below.
Make sure you have the reference to the Outlook Object
Library turned on. I am currently using Outlook 97 and
Access 97. I think the code would be the same in the newer
versions, but I am not positive.

Dim myMail As New Outlook.Application
Dim myTask As Outlook.TaskItem

Set myTask = myMail.CreateItem(olTaskItem)
myTask.Subject = "Follow up"
myTask.DueDate = #12/15/03#
myTask.Body = "Follow up on deal . . ."
myTask.Display

Set myMail = Nothing
Set myTask = Nothing

Good luck with your project!
-----Original Message-----
I was hoping to create a script that would create an task
and add some text that says: "Follow up on [pipeline]!
[Customer] deal with [pipeline]![Manufacturer]" as the
task title.

Is this possible?

Also any tips on the date? We currently only track the
week that the PO is supposed to come in, so I am assuming
that I would need to create a dlookup table to insert the
right follow up date. Is it possible to do a dlookup
on
2
variables? We store Quarter in one field and Week
expected PO (Week 01 through Week 13) in another field.

.
.
.
 
Back
Top