How do I use Office 2007 embeded macro's in office 2003?

I have looked at the builtin templates in MSAccess 2007 (in particular contacts).  They have some very nice functions such as add from outlook,  show/hide fields all of which are done from embedded macros.  How can I find out what the code behind these are so that I can use the code in a clients MSAccess 2003 database
WNottsCAsked:
Who is Participating?
 
peter57rCommented:
The code used in that template uses VBA commands that are new in A2007 so you cannot copy them into A2003.
0
 
WNottsCAuthor Commented:
is there any way in MSAccess 2003 to do this?
0
 
WNottsCAuthor Commented:
this is fine for connecting directly to the contacts table

but how do I maintain a table in MSaccess and then on the attached form I can have buttons to either add a contact from outlook or I can add a manual record from the form.  It would also be useful to be able to have a button to sync the two at times as well?
0
 
WNottsCAuthor Commented:
Thanks for your help I have found the code to import contacts from outlook to MSAccess:-

Sub ImportContactsFromOutlook()

   ' This code is based in Microsoft Access.

   ' Set up DAO objects (uses existing "tblContacts" table)
   Dim rst As DAO.Recordset
   Set rst = CurrentDb.OpenRecordset("tblContacts")


   ' Set up Outlook objects.
   Dim ol As New Outlook.Application
   Dim olns As Outlook.Namespace
   Dim cf As Outlook.MAPIFolder
   Dim c As Outlook.ContactItem
   Dim objItems As Outlook.Items
   Dim Prop As Outlook.UserProperty

   Set olns = ol.GetNamespace("MAPI")
   Set cf = olns.GetDefaultFolder(olFolderContacts)
   Set objItems = cf.Items
   iNumContacts = objItems.Count
   If iNumContacts <> 0 Then
      For i = 1 To iNumContacts
         If TypeName(objItems(i)) = "ContactItem" Then
            Set c = objItems(i)
            rst.AddNew
            rst!FirstName = c.FirstName
            rst!LastName = c.LastName
            rst!Address = c.BusinessAddressStreet
            rst!City = c.BusinessAddressCity
            rst!State = c.BusinessAddressState
            rst!Zip_Code = c.BusinessAddressPostalCode
            ' Custom Outlook properties would look like this:
            ' rst!AccessFieldName = c.UserProperties("OutlookPropertyName")
            rst.Update
         End If
      Next i
      rst.Close
      MsgBox "Finished."
   Else
      MsgBox "No contacts to export."
   End If

End Sub


This seems to import all,  how do I change this to open up the outlook global address list selector and use the contact I select?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.