Convert Early Binding VBA to Late Binding VBA : Excel to Outlook Contacts

前端 未结 2 1408
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 01:04

Each employee gets an updated contact list. I\'m creating a macro in Excel that will delete all outlook contacts, then import all the contacts on that sheet into their main

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 01:41

    To use Late binding, you should declare all your Outlook-specific objects as Object:

    Dim olApp As Object, olNamespace As Object, olFolder As Object, olConItems As Object
    

    Then:

    Set olApp = CreateObject("Outlook.Application")
    

    This will make each computer create the olApp object from the Outlook library that is installed on it. It avoids you to set an explicit reference to Outlook14 in the workbook that you will distribute (remove that reference from the project before distributing the Excel file).

    Hope this helps :)

提交回复
热议问题