473,545 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA - Need help automating emails with Outlook

8 New Member
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 1542

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

Similar topics

0
1059
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 using vb.net. Thanks
2
4286
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
1480
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 in a table bound to that form. It all works great EXCEPT for one thing: Every time the user generates an email message to be placed into the...
1
2144
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 thing: When I make changes to the items in a folder I get the ItemAdd() event and the ItemChange() event but I do not ever get the ItemRemove() event.
4
4559
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 'Outlook.ItemEvents_Event'. Name 'olByReference' is not declared. Name 'olMailItem' is not declared. Name 'olTo' is not declared. How could i edit this code to...
1
7017
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 into a SQL Server database, and marks the email as read. My problem is that in the loop that checks for all the Unread emails in the folder, as...
16
6182
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 using which sends If you want to see the above code in its full context you can see it here: ...
8
6675
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, apart from the fact using Outlook creates a security confirmation message, which ruins the whole automation process. I cannot really bypass this. I...
0
1603
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
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7808
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.