473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VBA - Need help automating emails with Outlook

I have some VBA code that creates an email in Access and sends it from Outlook. It is based on a query with a list of email addresses. It sends the first email to Outlook and then I have to manually click the SEND button in Outlook ... and then the second email is sent to Outlook ... and so on...

The list of email addresses is getting quite long and I want to automate clicking the SEND button in Outlook from the VBA script...but don't know how!

Here is the VB code currently that works perfectly as long as I manually click the SEND button in Outlook for each email:

Expand|Select|Wrap|Line Numbers
  1. Dim counter As Integer
  2. Dim origemailstosend As Integer
  3.  
  4. counter = 1
  5. origemailstosend = Me![totalemails]
  6.  
  7. While counter <= origemailstosend
  8.       DoCmd.SendObject _ 
  9.            , _
  10.            , _ 
  11.            , _
  12.            [eMailclean], _ 
  13.            , _ 
  14.            "subscriptions@ourcompany.org", _
  15.            "Thank you for your purchase!", _ 
  16.            "Thank you for your purchase of the Money Matters handout and bible study series." & Chr(13) & Chr(13) & "Your Username is: " & [Acct_Number] & Chr(13) & "Your Password is: " & [ZipCode] & Chr(13) & Chr(13) & "Please go to www.ourcompany.org and click on the Stewardship Download Center to download your Money Matters files." & Chr(13) & Chr(13) & "Sincerely," & Chr(13) & Chr(13) & "Customer Service" & Chr(13) & "our company", _
  17.           True 
  18.  
  19.      Me![totalemails] = Me![totalemails] - 1
  20.      Requery
  21.      counter = counter + 1
  22. Wend
  23.  
  24. DoCmd.Close
  25.  
What I need to know is how to programatically click the SEND button in Outlook in the VBA code, or another way to release the email so the WEND can continue to loop without manually clicking the SEND button.

Thanks for any help.
Jan 28 '09 #1
0 1535

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Job Lot | last post by:
I how can create vb.net app that checks for emails sent to an address and extract the .xls file attached to the email to a specified location. Also, how can download and upload from a FTP address...
2
by: Bob | last post by:
Hi Everybody A tough one!!! Is there any way that incoming eMails (MailItems) into Ms Outlook can be used to automatically create records in a ms Access table or sub table. Smiley Bob
3
by: Lauren Wilson | last post by:
Hi folks, We have an Access 2000 app that is highly integrated with Outlook 2000 or later. The app allows the user to send predefined emails that are created through an Access form and stored...
1
by: Richard | last post by:
All, I am writing an Outlook 2000 Add-In .DLL program. I have applied the necessary knowledge base fixes to enable event handling in Outlook 2000 and everything is working except for one...
4
by: Nicole | last post by:
I found this code below to use to send emails using VB with Outlook. However, it gives these errors. 'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and...
1
by: PhilD | last post by:
My C#.NET console app checks a public folder every 24 hours for incoming emails. For each unread email in the folder, it copies any attachments to the network, then loads the contents of these files...
16
by: Kosmos | last post by:
Good afternoon everyone, just wondering if anyone knew if it's possible to send meetings or appointments through email when you run VBA or SQL code in Access 2003? The following is the code I've been...
8
by: Lazster | last post by:
Hi, I am using Access in Office 2003 to try to automate messaging people in my organisation after a certain period has passed. I have managed to do this fine with what little knowledge I have,...
0
by: printline | last post by:
Hello I have the following macro for outlook: Dim oApp As Application Dim oNS As NameSpace Dim oMsg As Object Dim bDoAction As Boolean Dim oAttachments As Outlook.Attachments
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.