• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Outlook tasks

I am trying to access my tasks in Outlook 97 from vb 5.0, and put them into a table in MS Access 8.0. I would like to place each field in my tasks folder into a corrsponding field in the Access table. What is the code I need to do this?
0
damonc090698
Asked:
damonc090698
  • 3
  • 2
1 Solution
 
damonc090698Author Commented:
Edited text of question
0
 
VerolandCommented:
do you want the code for outlook or the code for Access, or both ?
0
 
damonc090698Author Commented:
I need the vb 5.0 code to go into Outlook read the tasks and put them into Access. I want the code in VB 5.0!
0
 
VerolandCommented:
For this example I have referenced DAO 3.5 and the msoutl85.olb file. There is a help file available (confusing though) called VBAOUTL.HLP wich is on the msoffice CD. Notify me if you want more info.

    Dim oApplic As Object
    Dim oItem As Object
    Dim olNameSpace As Object
    Dim DB As Database
    Dim SQL As String
    Dim I As Integer
       
    'connect to access database
    Set DB = OpenDatabase(App.Path & "\MyDB.mdb")
   
    'connect to the Outlook tasks
    Set oApplic = CreateObject("Outlook.Application")
    Set olNameSpace = oApplic.GetNamespace("MAPI")
    Set oItem = olNameSpace.GetDefaultFolder(olFolderTasks)
   
    'get the outlook tasks and insert access database
    For I = 1 To oItem.Items.Count
        SQL = "Insert into AccessTasks (TaskName) select '" & oItem.Items(I) & "'"
        DB.Execute SQL
    Next I
0
 
damonc090698Author Commented:
Thanks! It worked great!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now