View Single Post
  #1  
Old March 17th 06, 12:27 PM posted to microsoft.public.outlook.program_vba
Sardonic
external usenet poster
 
Posts: 1
Default Using VBA for Outlook and VBA for Access within Access

I have an access application which is successfully calling the following VBA
procedures:

1) ns.Logon
2) stDocName = "Client Activity"
DoCmd.OpenForm stDocName, , , stLinkCriteria

However, the following procedure throws a compile error, "Method or Data
Member not found" - and highlights the .CreateItem method. What shall I do
to make this code work - I've adapted from VBA for Absolute beginners.
(p230-235) I have added the Outlook 11.0 library as a referece to my copy of
access.


Dim ol As Outlook.Application
Dim ns As NameSpace
Dim msg As MailItem

Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")

ns.Logon

Set msg = Application.CreateItem(olMailItem)

With msg
.Receipents.Add "email 1"
.Recipients.Add "email 2"
.Subject = "test1"
.Body = "This is a test"
End With

ns.Logoff



Ads