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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel To Outlook Link 1

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
0
0
GB
I want to use MS Excel 2000 to link to my Outlook 2000 calendar and return any entries that contain a keyword.

I am sure this is possible, but I have no idea where to start. Does anyone have any pointers (or sample code) please?

Cheers,

Ed Metcalfe.

Please do not feed the trolls.....
 
Hopefully this can get you started in the right direction

Sub GetCalendarItems()
'set reference in design mode to Microsoft Outlook xx.x
Dim objO As Outlook.Application
Dim objNS As NameSpace
Dim objCalendar As MAPIFolder
Dim objItem As AppointmentItem
Dim strSearchItem As String
Dim strSearchField As String

Set objO = New Outlook.Application
Set objNS = objO.GetNamespace("MAPI")
'get the calendar folder
Set objCalendar = objNS.GetDefaultFolder(olFolderCalendar)
strSearchItem = "Test" 'set the criteria to search for

'loop through all calendar items
For Each objItem In objCalendar.Items
'set search field to subject line, change to whichever field you want to search on. The intellisense should help you out here
strSearchField = objItem.Subject
If InStr(strSearchField, strSearchItem) > 0 Then
'if the item is found put into cell
Range("A1") = objItem.Subject
End If
Next


End Sub
 
Excellent. Thanks very much. Have a purple star!

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top