Microsoft Office Tutorials and References
In Depth Information
Adding Contacts to Outlook
where the objectVariable is the same name you specified in the Dim
statement and program is the name of the application. When you use the
Dim statements described in this section, the corresponding Set statements
for opening the applications are
Book IX
Chapter 1
Set XL as CreateObject(“Excel.Application”)
Set Wrd as CreateObject(“Word.Application”)
Set Olk as CreateObject(“Outlook.Application”)
Set PPT as CreateObject(“PowerPoint.Application”)
To control another program with VBA, you must first add the program’s
object library to VBA, using the References dialog box (refer to “Working
with Object Libraries,” earlier in this chapter).
In the next few sections, you see how Access can share information with
Outlook, Word, and Excel — oh, my!
Adding Contacts to Outlook
Suppose that you’re working on an Access program, and your users suggest
that it would be a good idea to give them the capability to add contacts from
the Access database to Microsoft Outlook. You could be mean and tell them to
type the contacts themselves, or you can impress them by adding a button to
a form that lets them add the current contact to their Outlook contacts.
Adding the contact button and code
Consider the form shown in Figure 1-3. This form is a basic customer contact
form that you might find in any of your applications, with one exception: the
addition of an Add to Outlook Contacts button.
Figure 1-3:
an Access
form to let
users add
contacts to
Search JabSto ::

Custom Search