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

社会主义新天地 提交于 2019-11-28 01:46:25

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 :)

All of your Outlook object declarations would first have to become non-Oulook related object declarations.

Dim olApp As Object 
Dim olNamespace As Object 
Dim olFolder As Object 
Dim olConItems As Object 
Dim olItem As Object 

You will need a CreateObject function on the Outlook.Application object.

Set olApp = CreateObject("Outlook.Application")

Everything else should fall into place.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!