Connecting Outlook folders to access (1 Viewer)

  • Thread starter Thread starter AJB
  • Start date Start date
A

AJB

Guest
Does anyone know how I can connect to Outlook from access and view user-defined fields from the folders?
Thanks, Alex
 
This code will set a link in you MDB:


Sub LinkExchangeFolder()
Dim dbs As Database, tdf As TableDef, str As String
Const conTableExists = 3012
On Error GoTo ErrorHandler
Set dbs = CurrentDb
str = "Exchange 4.0;MAPILEVEL=Personal Folders|;" _
& "TABLETYPE=0;" _
& "DATABASE=" & dbs.Name & ";" _
& "Profile=Microsoft OutLook;PWD= ;"
Set tdf = dbs.CreateTableDef("tblInbox")
tdf.Connect = str
tdf.SourceTableName = "Inbox" 'Change this to the Folder you are trying to look in
dbs.TableDefs.Append tdf
RefreshDatabaseWindow
link_exit:
dbs.Close
Set dbs = Nothing
Exit Sub
ErrorHandler:
If Err = conTableExists Then
MsgBox "The table you are trying to create already exists."
Resume link_exit
Else
MsgBox "Error: " & Err.Number & ": " & Err.Description
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom