Saveasoutlookcontact Problem RRS feed

  • Question

  • Hi,

    I've searched for an answer to this all over the internet well google anyway.

    I have tried to place a button which will add a contact through the Runcommand SaveAsOutlookContact.

    When the button is clicked it has no effect at all, no error message and no outlook contact created.

    Am I missing something simple or, as the google search seems to hint, there's an issue with the command itself?


    Thanks in advance.

    Tuesday, April 12, 2011 10:16 AM

All replies

  • Hi,

    are you trying this via macro or VBA?

    For VBA these commands are:

    DoCmd.RunCommand acCmdSaveAsOutlookContact


    DoCmd.RunCommand 584

    You can try to open an Immediate window (ctrl+G), paste any line of the provided above and press Enter button. There is a chance to receive an error description.

    But according to your syntax you are using Macro builder. Maybe this article will be interesting for you

    And you can open Contacts.accdb template database to test its SaveAsOutlookContact. If it doesn't work too you can check your security options, trusted locations etc.


    Andrey V Artemyev | Saint-Petersburg, Russia
    Tuesday, April 12, 2011 10:46 AM
  • Thanks for your input however I have run both codes in VBA and neith work I get the Saveasoutlookcontact is not available
    Friday, April 15, 2011 3:53 PM
  • Hi,

    I've just installed Outlook to try reproducing your issue. But all works fine.

    Steps I made:

    1. Open my Access 2010 (BTW, what version are you using?).

    2. Open Contacts template.

    3. Open Contact Details Form and fill some fields


    4. Click 'Save As Outlook Contact' button and see the followingcontacts

    As you can see all works as expexted. One thing is interesting: the chosen cintact image isn't transfered to Outlook. 

    Then I go to the Macro builder to see how this button works in this template:


    So, you can check:

    1. You Access and Outlook versions.

    2. Your macros are enabled. By default a message about it appears when you open a database. You can also check this in Trust Center settings.

    3. Press Alt+F11 to open VB editor then Menu -> Tools -> References to check whether there are some words 'MISSING'.


    Andrey V Artemyev | Saint-Petersburg, Russia
    Saturday, April 16, 2011 8:50 PM
  • This is a database that I have created and not the Contacts template.

    Outlook 2007

    Access accdb (2007)

    A simple button with the below VBA

    Option Compare Database

    Private Sub cmdSaveAsOutlookContact_Click()
    DoCmd.RunCommand acCmdSaveAsOutlookContact
    End Sub

    Unfortunately this is still 'unfixed'

    Thanks for your input anyway.

    Wednesday, April 20, 2011 7:14 AM
  • I understand that you try to implement it into your own db. I just want to be sure where the problem lies. Could you, please, try this button in the Contacts template? Then we will know if it doesn't work for you anywhere or just within your db.
    Andrey V Artemyev | Saint-Petersburg, Russia
    Wednesday, April 20, 2011 7:21 AM
  • I have downloaded and tested the contacts database and it works fine.


    Wednesday, April 20, 2011 2:29 PM
  • I understand your problem now. I created a blank form with unbound textboxes and even gave them names as were in Outlook (Last Name, First Name, E-mail Address). But after running DoCmd.RunCommand acCmdSaveAsOutlookContact, I get an error '2046' that this command isn't available now. I've already googled all the web but has found nothing about fields requirements for this command. The only things I saw:

    1. Some users have problems with linked tables when using this command.

    2. There is some info in MS blog that this new feature was added but w/o any explanation.

    3. All the examples are related to Contacts template.

    The only thing I can think is that there must be an internal table with the structure like in Contacts template. Can you describe your form/table fields (with names)?

    And a question to somebody from MS, could you, please, provide some info about fields requirements when using this commands?

    As for me, I would use an Automation for these purposes. But there are still a significant number of people who cannot or don't want to go into VBA and just want to use a simple macro to export contacts from their tables via form.

    Andrey V Artemyev | Saint-Petersburg, Russia
    • Proposed as answer by Bruce Song Tuesday, April 26, 2011 2:09 AM
    Friday, April 22, 2011 6:10 AM
  • I've decided to remove this option from my database. It's causing too many headaches and is not a necessity for my customer.

    I would still like to know for future reference if anyone finds a cure.

    Thanks Andrey for your help.



    Wednesday, April 27, 2011 1:07 PM
  • I saw this feature in the Contacts template and tried to use it with my own Access 2007 contacts table and own form and it didn't work.  Since my field names were very similar I changed them to match the template and gave the table the same name: Contacts.  I took their form, also called Contacts, changed the theme to match colors in my database and it now works without error.  I also changed all the macros to code because I don't like working with macros.

    I now have both of these options, which work with the Contact form and Contact table, but not with my original frmContact or tblContact where they were giving the errors stated above.
        DoCmd.RunCommand acCmdSaveAsOutlookContact
        DoCmd.RunCommand acCmdAddFromOutlook

    There must be some kind of field name matching between Access and Outlook, even though my original table came from an export of the Outlook contacts, using the field names it created.  Maybe it's still not too late to add the feature into your database?


    Thursday, June 16, 2011 12:24 PM
  • God!!  I searched all over trying to remedy this.  I was about to give up when I found a better answer than using a buggy SaveAsOutlookContact.


    The code below works perfectly.  Just select the fields and fix the inputs.  ALSO,  here's the link where it came from - this guy deserves the credit !



    VBA – Create an Outlook Contact

    The following procedure illustrates how easily one can use VBA to create an Outlook Contact using Late binding so no references are required. Also note, there are many more contact properties available to the VBA programmer, for a full list consult the Outlook Help file.


    Function AddOlContact()
    On Error GoTo Error_Handler
      Const olContactItem = 2
      Dim olApp As Object
      Dim Ctct As Object
      Set olApp = CreateObject("Outlook.Application")
      Set olContact = olApp.CreateItem(olContactItem)
      With olContact
        .FirstName = "Daniel"
        .LastName = "Alba"
        .JobTitle = ""
        .CompanyName = "MINI CARDA"
        .BusinessAddressStreet = "22 ClearPoint"
        .BusinessAddressCity = "Pointe-Claire"
        .BusinessAddressState = "Quebec"
        .BusinessAddressCountry = "Canada"
        .BusinessAddressPostalCode = "H9X 3A6"
        .BusinessTelephoneNumber = "(514) 488-0956"
        .BusinessFaxNumber = ""
        .Email1Address = ""
        .MobileTelephoneNumber = ""
        .Save 'use .Display if you wish the user to see the contact pop-up
      End With
      On Error Resume Next
      Set olContact = Nothing
      Set olApp = Nothing
      Exit Function
      MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf & "Error Number: " & _
      Err.Number & vbCrLf & "Error Source: AddOlContact" & vbCrLf & "Error Description: " & _
      Err.Description, vbCritical, "An Error has Occured!"
      Resume Error_Handler_Exit
    End Function



    Sunday, July 10, 2011 3:51 PM
  • Well done to the creator of this.

    However when I tested this against my form a slight flaw that if the textbox i have directed the code to ".FirstName = me.txtFirstname" is blank I receive an error:

    MS Access has generated the following error

    Error Number: -2147352571

    Error Source: AddOlContact

    Error Description: Type Mismatch: Cannot coerce parameter value

    Outlook cannot translate your string



    Wednesday, July 20, 2011 7:56 AM
  • Hi Matt,

    I know this is really old, and I am sure you have found the answer to your problem...but for everyone else looking for a solution to this problem, when assigning the olContact value to a form text field, add .Value to the end. for Matts example above, it would be Me.txtFirstName.Value

    Wednesday, November 27, 2013 12:38 PM