Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change code to Late Binding

Status
Not open for further replies.

DH

Programmer
Dec 8, 2000
168
What changes would need to be made to the following code snipped to make it late binding so that I do not need to reference the msoutl9.olb in the VBA references?

Here is the code:

Dim oOutlook As Outlook.Application
Dim oAppt As Outlook.AppointmentItem
Set oOutlook = New Outlook.Application
Set oAppt = oOutlook.CreateItem(olAppointmentItem)
With oAppt
.Start = due_date & " " & due_time
.Duration = ApptLength
.Subject = contactname & " - " & Notes
If Not IsNull(Notes) Then .body = Notes
If Not IsNull(ApptLocation) Then
.Location = ApptLocation
End If
If ApptReminder Then
.ReminderMinutesBeforeStart = ApptReminderMinutes
.ReminderSet = True
End If
.Save
End With
' Release Outlook object
Set oOutlook = Nothing

Thank you in advance for any suggestions/examples...

DH
 
Replace this:
Dim oOutlook As Outlook.Application
Dim oAppt As Outlook.AppointmentItem
Set oOutlook = New Outlook.Application
Set oAppt = oOutlook.CreateItem(olAppointmentItem)
By this:
Dim oOutlook As Object
Dim oAppt As Object
Set oOutlook = CreateObject("Outlook.Application")
Set oAppt = oOutlook.CreateItem(1) 'olAppointmentItem

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top