Trying to send mails throuh programs

V

Vinay Singh

My prob is that i am trying to send a mail content to a
distribution list in my address book. I am not sending it
manually because i want to send to them one by one and
also introduce a sleep time between each sent.

Error that I get -

"messaging interface has returned unknown error microsoft
outlook"


Code that I am using -

Sub abc()

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = _
myNameSpace.GetDefaultFolder(olFolderContacts)
Set myGAddressList = myNameSpace.AddressLists("Contacts")
Set myGEntry = myGAddressList.AddressEntries("GLT")

(I GET ERROR ON FOLLOWING LINE)
For Each xMember In myGEntry.Members
MsgBox xMember
Next

Set myDraftFolder = myNameSpace.GetDefaultFolder
(olFolderDrafts)
Set myMailItem = myDraftFolder.Items("Not much for a xyz
Career")
Set myMailItemCopy = myMailItem.Copy

For Each Item In myItem
myMailItemCopy.To = "x"
myMailItemCopy.Send
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top