A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tasks - convert email to task & attach email



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 10th 09, 08:12 PM posted to microsoft.public.outlook.program_vba
guiness_joe
external usenet poster
 
Posts: 1
Default Tasks - convert email to task & attach email

Please find below code which converts email into a task, and pastes the email
text body into the task body and also pastes the email as attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want it to be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the first few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" & vbCrLf & _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected ..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation, "Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit (Cancel)" & _
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or task
....")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub
Ads
  #2  
Old August 10th 09, 08:25 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Tasks - convert email to task & attach email

1) Outlook version?

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder?

3) No.

4) Please explain what you mean by that.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...
Please find below code which converts email into a task, and pastes the
email
text body into the task body and also pastes the email as attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want it to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the first few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" & vbCrLf & _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected ..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation, "Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit (Cancel)" &
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub



  #3  
Old August 11th 09, 04:13 PM posted to microsoft.public.outlook.program_vba
guiness_joe[_2_]
external usenet poster
 
Posts: 2
Default Tasks - convert email to task & attach email



"Sue Mosher [MVP]" wrote:

1) Outlook version? 2003

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder? Yes, the below task after being created saves into a Personal folder.

3) No.

4) Please explain what you mean by that.

Can appointments be made of the Incomplete Task items that exist in the task
folder?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...
Please find below code which converts email into a task, and pastes the
email
text body into the task body and also pastes the email as attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want it to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the first few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" & vbCrLf & _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected ..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation, "Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit (Cancel)" &
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub




  #4  
Old August 11th 09, 04:21 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Tasks - convert email to task & attach email

1) the attached email is pasted at the end of the task body. I want it
to
be
pasted at the beginning of the task followed by the task body.


Since you're using Outlook 2003, you can handle this by using the third
parameter of the Attachments.Add method, which sets the position of the
attachment, e.g.:

TI.Attachments.Add olItem, olEmbeddeditem, 1

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder? Yes, the below task after being created saves into
a Personal folder.


"a Personal Folder" doesn't really answer the question, but let's assume you
wan to create a new item in a non-default folder. To do that, use the Add
method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Task.YourFormName")

The message class parameter is optional.

To get a non-default folder, you need to walk the folder hierarchy using the
Folders collections or use a function that does that for you. For an
example, see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder path
string

Can appointments be made of the Incomplete Task items that exist in the
task
folder?


Yes, using the same technique that you're already using to create a task --
create the task then assign values to its properties.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...


"Sue Mosher [MVP]" wrote:

1) Outlook version? 2003

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder? Yes, the below task after being created saves into
a Personal folder.

3) No.

4) Please explain what you mean by that.

Can appointments be made of the Incomplete Task items that exist in the
task
folder?

"guiness_joe" wrote in message
...
Please find below code which converts email into a task, and pastes the
email
text body into the task body and also pastes the email as attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want it
to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the first
few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" & vbCrLf
& _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected ..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation, "Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit (Cancel)"
&
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or
task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub






  #5  
Old August 11th 09, 05:08 PM posted to microsoft.public.outlook.program_vba
guiness_joe[_2_]
external usenet poster
 
Posts: 2
Default Tasks - convert email to task & attach email

Thank you Sue!

1) TI.Attachments.Add olItem, olEmbeddeditem, 1
It attached an embedded picture of the email but not the email itself.

2) Your are right I have a personal folder which has Calendar and Task
inside it, which I wish to use. The Folder name is 01 Handover/Calendars, and
calendar folder name is Calendar and Task folder name is Task

5) If I create a couple of task form / templates, can I do all the previous
mentioned steps, i.e. paste email and email body at the end of the task
template body text? Also I want to have several Task forms / templates and
want to use one that suits the task function.

"Sue Mosher [MVP]" wrote:

1) the attached email is pasted at the end of the task body. I want it
be pasted at the beginning of the task followed by the task body.

Since you're using Outlook 2003, you can handle this by using the third
parameter of the Attachments.Add method, which sets the position of the
attachment, e.g.:

TI.Attachments.Add olItem, olEmbeddeditem, 1

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder? Yes, the below task after being created saves into
a Personal folder.


"a Personal Folder" doesn't really answer the question, but let's assume you
wan to create a new item in a non-default folder. To do that, use the Add
method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Task.YourFormName")

The message class parameter is optional.

To get a non-default folder, you need to walk the folder hierarchy using the
Folders collections or use a function that does that for you. For an
example, see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder path
string

Can appointments be made of the Incomplete Task items that exist in the
task
folder?


Yes, using the same technique that you're already using to create a task --
create the task then assign values to its properties.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...


"Sue Mosher [MVP]" wrote:

1) Outlook version? 2003

2) Do you mean that you want to create a task in a folder other than your
default Tasks folder? Yes, the below task after being created saves into
a Personal folder.

3) No.

4) Please explain what you mean by that.

Can appointments be made of the Incomplete Task items that exist in the
task
folder?

"guiness_joe" wrote in message
...
Please find below code which converts email into a task, and pastes the
email
text body into the task body and also pastes the email as attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want it
to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the first
few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" & vbCrLf
& _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected ..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation, "Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit (Cancel)"
&
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or
task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub






  #6  
Old August 11th 09, 05:19 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Tasks - convert email to task & attach email

1) This is a task you're attaching to? Tasks don't handle embedded items
well, for reasons that have never been satisfactorily explained, IMO.

2) Then you need to follow the instructions I gave for using the Items.Add
method. You will not, however, be able to use the GetFolder() function,
because it assumes that there are no slashes in the folder name. Instead,
you'll need to start at the top of the folder hierarchy and walk down, using
the Folders collection of each MAPIFolder. If you need help with that, you
will need to give us the complete and exact path to the folder(s), starting
at the top of the hierarchy.

5) If you want to do all the same procedures in a custom form, then invoke
the custom form using the message class parameter in the Items.Add method.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...
Thank you Sue!

1) TI.Attachments.Add olItem, olEmbeddeditem, 1
It attached an embedded picture of the email but not the email itself.

2) Your are right I have a personal folder which has Calendar and Task
inside it, which I wish to use. The Folder name is 01 Handover/Calendars,
and
calendar folder name is Calendar and Task folder name is Task

5) If I create a couple of task form / templates, can I do all the
previous
mentioned steps, i.e. paste email and email body at the end of the task
template body text? Also I want to have several Task forms / templates and
want to use one that suits the task function.

"Sue Mosher [MVP]" wrote:

1) the attached email is pasted at the end of the task body. I want it
be pasted at the beginning of the task followed by the task body.

Since you're using Outlook 2003, you can handle this by using the third
parameter of the Attachments.Add method, which sets the position of the
attachment, e.g.:

TI.Attachments.Add olItem, olEmbeddeditem, 1

2) Do you mean that you want to create a task in a folder other than
your
default Tasks folder? Yes, the below task after being created saves
into
a Personal folder.


"a Personal Folder" doesn't really answer the question, but let's assume
you
wan to create a new item in a non-default folder. To do that, use the Add
method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Task.YourFormName")

The message class parameter is optional.

To get a non-default folder, you need to walk the folder hierarchy using
the
Folders collections or use a function that does that for you. For an
example, see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder
path
string

Can appointments be made of the Incomplete Task items that exist in the
task
folder?


Yes, using the same technique that you're already using to create a
task --
create the task then assign values to its properties.

"guiness_joe" wrote in message
...


"Sue Mosher [MVP]" wrote:

1) Outlook version? 2003

2) Do you mean that you want to create a task in a folder other than
your
default Tasks folder? Yes, the below task after being created saves
into
a Personal folder.

3) No.

4) Please explain what you mean by that.
Can appointments be made of the Incomplete Task items that exist in the
task
folder?

"guiness_joe" wrote in message
...
Please find below code which converts email into a task, and pastes
the
email
text body into the task body and also pastes the email as
attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want
it
to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the
first
few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" &
vbCrLf
& _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected
..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation,
"Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf & _
"To Add Appointment (Yes) / To Add Task (No) / To Quit
(Cancel)"
&
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment or
task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub



  #7  
Old August 11th 09, 05:41 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Tasks - convert email to task & attach email

An alternative to attaching an item to a task is try using a link instead.
Or prefix the item body with the other item's EntryID in the format shown at
http://www.slipstick.com/outlook/links.htm.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Sue Mosher [MVP]" wrote in message
...
1) This is a task you're attaching to? Tasks don't handle embedded items
well, for reasons that have never been satisfactorily explained, IMO.

2) Then you need to follow the instructions I gave for using the Items.Add
method. You will not, however, be able to use the GetFolder() function,
because it assumes that there are no slashes in the folder name. Instead,
you'll need to start at the top of the folder hierarchy and walk down,
using the Folders collection of each MAPIFolder. If you need help with
that, you will need to give us the complete and exact path to the
folder(s), starting at the top of the hierarchy.

5) If you want to do all the same procedures in a custom form, then invoke
the custom form using the message class parameter in the Items.Add method.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"guiness_joe" wrote in message
...
Thank you Sue!

1) TI.Attachments.Add olItem, olEmbeddeditem, 1
It attached an embedded picture of the email but not the email itself.

2) Your are right I have a personal folder which has Calendar and Task
inside it, which I wish to use. The Folder name is 01 Handover/Calendars,
and
calendar folder name is Calendar and Task folder name is Task

5) If I create a couple of task form / templates, can I do all the
previous
mentioned steps, i.e. paste email and email body at the end of the task
template body text? Also I want to have several Task forms / templates
and
want to use one that suits the task function.

"Sue Mosher [MVP]" wrote:

1) the attached email is pasted at the end of the task body. I want it
be pasted at the beginning of the task followed by the task body.

Since you're using Outlook 2003, you can handle this by using the third
parameter of the Attachments.Add method, which sets the position of the
attachment, e.g.:

TI.Attachments.Add olItem, olEmbeddeditem, 1

2) Do you mean that you want to create a task in a folder other than
your
default Tasks folder? Yes, the below task after being created saves
into
a Personal folder.

"a Personal Folder" doesn't really answer the question, but let's assume
you
wan to create a new item in a non-default folder. To do that, use the
Add
method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Task.YourFormName")

The message class parameter is optional.

To get a non-default folder, you need to walk the folder hierarchy using
the
Folders collections or use a function that does that for you. For an
example, see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder
path
string

Can appointments be made of the Incomplete Task items that exist in
the
task
folder?

Yes, using the same technique that you're already using to create a
task --
create the task then assign values to its properties.

"guiness_joe" wrote in message
...


"Sue Mosher [MVP]" wrote:

1) Outlook version? 2003

2) Do you mean that you want to create a task in a folder other than
your
default Tasks folder? Yes, the below task after being created saves
into
a Personal folder.

3) No.

4) Please explain what you mean by that.
Can appointments be made of the Incomplete Task items that exist in
the
task
folder?

"guiness_joe" wrote in
message
...
Please find below code which converts email into a task, and pastes
the
email
text body into the task body and also pastes the email as
attachment.

Problem:

1) the attached email is pasted at the end of the task body. I want
it
to
be
pasted at the beginning of the task followed by the task body.
2) Can the task be automatically be saved into a personal folder?
3) Is there a way to autotype the categories list by typing the
first
few
letters?
4) Is there a way to auto fill calendar with the task items?

Public Sub AddCalendarEntry()
Const mailItem_c As String = "MailItem"
Dim OE As Outlook.Explorer ' olExp
Dim MI As Outlook.MailItem
Dim AI As Outlook.AppointmentItem
Dim TI As Outlook.TaskItem ' olTask
Dim olItem As Object

Set OE = Application.ActiveExplorer

'Abort sub if no item selected:
If OE.Selection.Count 1 Then
MsgBox "Please select an already saved message before" &
vbCrLf
& _
"attempting to create an appointment or task" & vbCrLf & _
"with this button ...", vbInformation, "No message selected
..."
Exit Sub
'Abort sub if item selected is not a MailItem.
ElseIf TypeName(OE.Selection(1)) mailItem_c Then
MsgBox "You must select a mail item...", vbInformation,
"Invalid
selection..."
Exit Sub
End If

Set MI = OE.Selection(1)
Beep
Select Case MsgBox("Is calendar entry an appointment?" & vbLf &
_
"To Add Appointment (Yes) / To Add Task (No) / To Quit
(Cancel)"
&
_
vbCrLf, vbYesNoCancel + vbQuestion, "Create an appointment
or
task
...")
Case vbYes 'If yes, create appointment
Set AI = Outlook.CreateItem(olAppointmentItem)
With AI
.Subject = MI.Subject

.Body = MI.Body
.Save
.Display
End With
Case vbNo
'If no, create task due with date of today
'and due date is tomorrow at 10:00 am

Set TI = Application.CreateItem(olTaskItem)

With TI

Dim cntSelection As Integer
cntSelection = OE.Selection.Count

For i = 1 To cntSelection

Set olItem = OE.Selection.Item(i)
TI.Attachments.Add olItem

Next

.Subject = MI.Subject
.Body = MI.Body
' .StartDate = Date
' .DueDate = Date + 1
' .ReminderTime = .DueDate & " 10:00"
.Save
.Display

End With

'Case vbCancel
' Exit Sub
End Select
End Sub





 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email to Task, move task to 'Other Tasks' folder to sync w/Sharepoint mitcham Outlook and VBA 3 August 26th 08 06:55 AM
Creating Task from Email -- How can I Link Back to Original Email? Steve Newhouse Outlook and VBA 1 July 19th 07 05:36 PM
2 simple macros - create task from email and move email to folder [email protected] Outlook and VBA 5 February 4th 07 10:57 AM
attach outlook email in email? Susan Outlook - General Queries 3 December 13th 06 05:14 PM
Is this a bug? attach email in another email issues matchbox Outlook - General Queries 0 May 3rd 06 09:53 AM


All times are GMT +1. The time now is 09:19 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.