Andrus1


Is it possible to pass Outlook information such as dates and durations of meeting to an Excel spreadsheet I would need to do this via a macro. I need this to create a time card that tracks how much time is being spent in meetings. Thanks!


Re: PASSING MS OUTLOOK DATA TO EXCEL

Andy Pope


Hi,

This will pull calander information from Outlook into the activesheet in excel.
Remember to include a reference to the Outlook library. Within VBE use Tools > References.

Sub GetOLCalander()
'
' requires reference to Outlook Library
'
Dim olApp As Outlook.Application
Dim objNameSpace As Outlook.Namespace
Dim olItem As Outlook.AppointmentItem
Dim lngRow As Long

Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")

ActiveSheet.Range("A1:C1") = Array("Subject", "Start", "Finish")
lngRow = 2
For Each olItem In objNameSpace.GetDefaultFolder(olFolderCalendar).Items
With ActiveSheet
.Cells(lngRow, 1).Value = olItem.Subject
.Cells(lngRow, 2).Value = olItem.Start
.Cells(lngRow, 3).Value = olItem.End
End With
lngRow = lngRow + 1
Next

Set objNameSpace = Nothing
Set olApp = Nothing

End Sub







Re: PASSING MS OUTLOOK DATA TO EXCEL

Andrus1

Thank you!! I will have to disect this to figure out what exactly it's doing, but it does work! Thanks again! You guys and gals are great. Thank you for being there!