|
-
Feb 23rd, 2006, 02:28 PM
#1
Thread Starter
New Member
How do I add an outlook task
I want to create an outlook task based on a userform textbox entry (e.g. AA001 AA002 etc).
I would like to create the task so that the start date and due date are 20 working days in the future and creation is triggered when an email is sent.
Can anybody help please?
-
Feb 23rd, 2006, 03:12 PM
#2
Re: How do I add an outlook task
Yes, but from within Outlooks VBA or from VB6?
Moved from Classic VB.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 03:15 PM
#3
Thread Starter
New Member
Re: How do I add an outlook task
-
Feb 23rd, 2006, 03:21 PM
#4
Re: How do I add an outlook task
I whipped this up real fast so it may have an error but its the logic and mechanics that are important.
VB Code:
Option Explicit
'Add a reference to MS Outlook xx.0 Object Library
'Outlook 2003 used for the ex.
Public WithEvents oApp As Outlook.Application
Private oApp As Outlook.Application
Private Sub Form_Load()
Set oApp = New Outlook.Application
End Sub
Private Sub oApp_NewMailEx(ByVal EntryIDCollection As String)
Dim oTask As Outlook.TaskItem
Dim oEmail As Object
Set oEmail = EntryIDCollection
Set oTask = oApp.CreateItem(olTaskItem)
With oTask
.StartDate = DateAdd("d", 20, Date)
.DueDate = DateAdd("d", 20, Date)
.Subject = oEmail.Subject & " - I dont know"
.ReminderSet = False
.Body = "Dont forget."
.Save
End With
Set oEmail = Nothing
Set oTask = Nothing
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 03:38 PM
#5
Thread Starter
New Member
Re: How do I add an outlook task
Thanks
Being new to this though I'm stuck when I get the following error
Compile Error
User-defined tyoe not defined
for the Dim oTask As Outlook.TaskItem line
Have I missed something?
-
Feb 23rd, 2006, 03:42 PM
#6
Re: How do I add an outlook task
Yes, you need to 'Add a reference to MS Outlook xx.0 Object Library
by going into your Project menu and clicking References.... Then select Outlook and click OK. 
What version of Outlook are you running?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 03:49 PM
#7
Thread Starter
New Member
Re: How do I add an outlook task
Oh ok
Outlook 2003 (11.5608.5606)
-
Feb 23rd, 2006, 03:51 PM
#8
Re: How do I add an outlook task
Ok, then everythng should be supported in your version. I am running Office SP2 though but shouldnt make a difference here.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 03:57 PM
#9
Thread Starter
New Member
Re: How do I add an outlook task
Yep added no problem
Thanks
-
Feb 23rd, 2006, 04:01 PM
#10
Re: How do I add an outlook task
Your Welcome 
Ps, dont forget to 'Resolve' your thread now that its solved.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|