473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to read all Outlook task fields in Access database.

I am trying to wite a vba code to read all my outlook task fields in Access database. So far I have following code:
Expand|Select|Wrap|Line Numbers
  1. Sub OutlookTasks()
  2.  
  3. Dim ol As Object
  4. Dim olns As Object
  5. Dim objFolder As Object
  6. Dim objAllTasks As Object
  7. Dim Task As Object
  8. ' Set the Application object.
  9. Set ol = New Outlook.Application
  10. ' Set the Namespace object.
  11. Set olns = ol.GetNamespace("MAPI")
  12. ' Set the default Tasks folder.
  13. Set objFolder = olns.GetDefaultFolder(olFolderTasks)
  14. ' Set objAllTasks equal to the collection of all Tasks.
  15. Set objAllTasks = objFolder.Items
  16. ' Loop through each Task.
  17. For Each Task In objAllTasks
  18. ' Display the Body field for the Task.
  19. MsgBox "Task: " & Task.Subject & " Last Update: " & Task.Role
  20. Next
  21. End Sub
  22.  
I am getting a "compile error: user-defined type not defined" error. I am a total amateur in vba, any help would be great!
May 7 '10 #1
2 4618
patjones
931 Expert 512MB
Hi,

I think you need to set a reference for Access VBA to be able to communicate with Outlook. For instance, in 2007 you go Tools > References... and then scroll down the list and check mark "Microsoft Outlook 12.0 Object Library" and click OK.

The code should compile after setting the proper reference.

Pat
May 7 '10 #2
Can you just attach to the PST file and reference it from a linked table?
May 9 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: darkelf | last post by:
Hello, I have a site that uses windows authentication and I demand credentials for files inside a specific folder. (through web.config). My problem is that when I try to read something from my...
7
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database...
4
by: Ecohouse | last post by:
I need to be able to access an Outlook folder and read each email and pull data from the email into tables in Access and move the email to another folder. I now about automation but am not sure...
4
by: Eifel-benz | last post by:
How to get connection to a MS Access database? How to read from a MS Access database? How to close the connection to a MS Access database?
8
by: Tim Murphy | last post by:
How do you read/write a Word document embedded in an OLE Object field in an Access table with VB.NET? I have an Access application where users are creating and editing Word documents that are...
1
by: elena | last post by:
I have large flat file with fixed record lenght, i have to parse record and populate table with multi columns with the data, please any links or code snipets to this topic will be greatly...
16
by: Kosmos | last post by:
Good afternoon everyone, just wondering if anyone knew if it's possible to send meetings or appointments through email when you run VBA or SQL code in Access 2003? The following is the code I've been...
1
by: tymperance | last post by:
I have a 2007 database that I need to add a command button that will open a new Outlook task and allow the user to input the assignment, start date, due date, etc. I've got plenty of code scripting...
0
by: Chad Dashner | last post by:
I am somewhat new at VB and I am looking to be able to create an outlook task from an access 2010 form. Is there an easy way to do this?
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.