Need Help with VBA to allow Excel to update Outlook

hetterbr

Board Regular
Joined
Jul 8, 2011
Messages
56
Hi there, new to the forum here.

I am wanting to have data entered into Excel that would create a meeting request in Outlook. I have Office 2010 and am on Windows XP.

Column A - Contains the date that I want to have as the meeting date
Column B - Contains the meeting subject Line
Column C - Contains the contents of the meeting

I would like it to look at all items and post new meeting requests only, no duplicates.

Here is what i have found so far, it only works to create 1 meeting request, can't get it to do more:

Private Sub AddToOLCalendar()

Dim objOL As Object
Dim objItem As Object
Dim lngRow As Long

Set objOL = CreateObject("Outlook.Application")

lngRow = 1
Do While ActiveSheet.Cells(lngRow, 1) <> ""
If ActiveSheet.Cells(lngRow, 2).Text <> "" Then
Set objItem = objOL.CreateItem(1) ' constant olAppointmentItem = 2

With objItem
.Body = Range("c1")
.Duration = 15
.Start = Range("A1") & " 9:00:00 AM"
.Subject = Range("B1")
.Save
End With
End If
lngRow = lngRow + 1
Loop
Set objItem = Nothing
Set objOL = Nothing

End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Yes, you are correct. I can't seem to figure out how to put into the formula to look at a range of data.
 
Upvote 0
Yes, this is exactly what I was looking for. thanks.

It now presents another problem, but I will post a new thread for that issue.

thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,854
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top