For some reason, I can only get the DoCmd.SendObject to work only once, the very first time, in a loop. Why is this? It goes to the command, but doesn't generate anything. How do I fix this? Thanks.
The code below is from GammelNok (Hans) and it works great:
Dim objOutLook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMailItem As Outlook.MailItem
Dim strSendTo As String
Dim strSubject As String
Dim strText As String
'======================================================
Set objOutLook = New Outlook.Application
Set objNameSpace = objOutLook.GetNamespace("MAPI"
Set objMailItem = objOutLook.CreateItem(olMailItem)
strSendTo = "xxxx.yyyy@zzz.co.uk"
strSubject = "Test01"
strText = "Hi. Your request processed as requested"
With objMailItem
.To = strSendTo
.Subject = strSubject
.Body = strText
.Send
End With
Set objOutLook = Nothing
Set objNameSpace = Nothing
Set objMailItem = Nothing
end sub
My docmd.sendobject worked fine in Access97.
But it didn't work in Access2000.
That solution worked ok, but, each time, i got a pop up message from Outlook: "a program is trying to access email addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose no."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.