Having a problem with late binding (Outlook), please help

G

Gina Whipp

Hello All,

I got everyting but this task thing working and I'm getting fustrated...
Below is the original code courtesy of Microsoft. Below is the code I use
to Initialize Outlook and so far it works for sending mail but I can't
figure out which lines need to be remmed out for it to work for tasks. I
rem'd out 2 lines but still not working, please help.

*****From Microsoft Automation Sample
Function fncAddOutlookTask()
'Dim golApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem <---- this is where it stops on
compile telling undefined
'Set golApp = CreateObject("Outlook.Application")
Set OutlookTask = golApp.CreateItem(olTaskItem)
With OutlookTask
.Subject = "This is the subject of my task"
.Body = "This is the body of my task."
.ReminderSet = True
'Remind 2 minutes from now.
.ReminderTime = DateAdd("n", 2, Now)
'Due 5 minutes from now.
.DueDate = DateAdd("n", 5, Now)
.ReminderPlaySound = True
'Modify path.
.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save
End With
End Function


*****This is the code I use to InitializeOutlook
Public golApp As Object
Public golNameSpace As Object
Public objRecip As Object
Public objNewMail As Object 'Outlook.MailItem
Function InitializeOutlook() As Boolean
' This function is used to initialize the global Application and
' NameSpace variables.

On Error GoTo Init_Err
Set golApp = CreateObject("Outlook.Application", "LocalHost") '
Application object
Set golNameSpace = golApp.GetNamespace("MAPI") ' Namespace object
Set objNewMail = golApp.CreateItem(0)
InitializeOutlook = True
Init_Bye:

Exit Function
Init_Err:
InitializeOutlook = False
Resume Init_Bye

End Function
*****Code End*****

Thanks for any and all help...
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 
R

Robert Morley

So glad we could help. :)


Rob

Gina Whipp said:
I got it... thanks anyway!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top