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

Export Tasks to html file

Status
Not open for further replies.

rssql

Programmer
Jul 22, 2002
87
US
I would like to automatically export certain catagories of tasks to an html file twice a day.

Not sure where to start.


Fighting for the cause of tolerance and diversity, or was it in-tolerance and perversity? Just different sides of the same coin.
 
Here is someplace to start.

This rough code snipit will connect to the Tasks folder in Personal Folders, enumerate through the tasks, asnd build a very simple HTML file containing one table that hold the Subject and Due Date.

I leave it to you to filter the Tasks by catagory, determine the final layout of the HTML file, and exactly how to invoke this macro.

Code:
Public Sub TasksToHTML()
Dim objOutlook As New Outlook.Application
Dim FolderItems As Object
Dim FolderItem As Object
Dim intFileNumber As Integer

Set FolderItems = objOutlook.Session.Folders("Personal Folders").Folders("Tasks")
intFileNumber = FreeFile()

Open "C:\Tasks.htm" For Output As intFileNumber
'Write the minimum HTML header
Print #intFileNumber, "<HTML><BODY>"

'Write the Table header
Print #intFileNumber, "<TABLE>"

For Each FolderItem In FolderItems.Items
  'Write the Subject and Due Date from the current task to the file
  Print #intFileNumber, "<TR><TD>" & FolderItem.Subject & "</TD><TD>" & _
                        Format(FolderItem.DueDate, "mm/dd/yy") & "</TD></TR>"
Next FolderItem

'Write the Table footer
Print #intFileNumber, "</TABLE>"

'Write the minimum HTML footer
Print #intFileNumber, "</BODY></HTML>"
Close #intFileNumber

Set FolderItem = Nothing
Set FolderItems = Nothing
Set objOutlook = Nothing
End Sub

If you have luck with this or have questions please post back and I will help if I can.

CMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top