AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

VBA and Outlook.

Add Task


This application will demonstrate how to connect AutoCAD and Outlook using VBA. It will allow you to add a Task to Outlook along with a reminder time and a due time. Special thanks to Randall Raath of VBDesign for this idea.

Here is the complete source coding : 

Private Sub CommandButton1_Click()
End Sub
Sub AddTask()
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Dim Rem1 As Integer
Dim Due1 As Integer

Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)

Rem1 = (CInt(UserForm1.TextBox3.Text) * 60) _
+ CInt(UserForm1.TextBox5.Text)
Due1 = (CInt(UserForm1.TextBox4.Text) * 60) _
+ CInt(UserForm1.TextBox6.Text)
With taskOutLook
.Subject = UserForm1.TextBox1.Text
.Body = UserForm1.TextBox2.Text

.ReminderSet = True

.ReminderTime = DateAdd("n", Rem1, Now)
'set the reminder time

.DueDate = DateAdd("n", Due1, Now)
'set the due time

.ReminderPlaySound = True

.ReminderSoundFile = "C:\Windows\Media\Ding.WAV"
'Add the path to a .wav file on your computer.

End With
Set taskOutLook = Nothing

Set appOutLook = Nothing
End Sub

Private Sub CommandButton2_Click()
End Sub

Private Sub UserForm_Initialize()
UserForm1.TextBox1.SelStart = 0
UserForm1.TextBox1.SelLength = _
End Sub 

If you would like a copy of this module, just click here. Enjoy.......

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website