|
-
Oct 27th, 2008, 08:11 AM
#1
Thread Starter
New Member
Automated Daily Email in Microsoft Outlook
Hi, let me first introduce myself as a new member and a complete VBA noob. I found the site looking for a way to write a macro in Microsoft Outlook. I have used macros in Excel but I barely write the code, I cheat and use the "record" button.
What I need to do is this:
I need a way that I can have outlook send an email with a short bit of text every day. It will be the same text (just 3 words really). It will be sent to the same person every day. It would be really great if I could make it randomly send the email between 6am and 7am. If this is too much work then one standard time would be fine, or it could be when I start outlook each morning. If anyone can help I'd really appreciate it.
-
Oct 27th, 2008, 08:28 AM
#2
Hyperactive Member
Re: Automated Daily Email in Microsoft Outlook
hi,
Sending mail via Outlook (Not Outlook Express) requires autorisation from the user. there is a security feature that prevents "mail Boming" using MS outlook.
there is a way to send the mail but it will require some imput from a user when the mail is to be sent.
if you want to send the mail by cliking the button then let me know and i will get some code up for you.
also please confirm it is outlook and the Version?
thanks
David
-
Oct 27th, 2008, 09:39 AM
#3
Thread Starter
New Member
Re: Automated Daily Email in Microsoft Outlook
 Originally Posted by Davadvice
hi,
Sending mail via Outlook (Not Outlook Express) requires autorisation from the user. there is a security feature that prevents "mail Boming" using MS outlook.
there is a way to send the mail but it will require some imput from a user when the mail is to be sent.
if you want to send the mail by cliking the button then let me know and i will get some code up for you.
also please confirm it is outlook and the Version?
thanks
David
Yes sir, outlook 2003 it is.
-
Oct 28th, 2008, 05:12 AM
#4
Hyperactive Member
Re: Automated Daily Email in Microsoft Outlook
Hi,
here is the code you will need to send the mail.
i'm not too sure about using a timer with outlook to send at a specific time. I will look into it later and get back.
If you go to tools>Macro and click on Vb Editor
on the left expand the tree and select this outlook session.
paste the below code and add an e-mail address (your own should be used to test) to this line in the code. omsg.Recipients.Add "enterEmailAddressHERE"
vb Code:
Public Sub SndFirstMail()
Dim strmsg As String
Dim oApp As New Outlook.Application
Dim omsg As Outlook.MailItem
strmsg = "Test" & vbCrLf & " I am testing this message"
Set omsg = oApp.CreateItem(olMailItem)
omsg.Recipients.Add "enterEmailAddressHERE"
omsg.Body = strmsg
omsg.Send
End Sub
if you press F8 it will allow you to step through the code.
good luck
David
-
Nov 11th, 2008, 07:22 AM
#5
Thread Starter
New Member
Re: Automated Daily Email in Microsoft Outlook
How will it know to send this once per day?
-
Nov 12th, 2008, 08:36 AM
#6
Hyperactive Member
Re: Automated Daily Email in Microsoft Outlook
Hi
you will have to add a sub and set up a timer when the timer reaches a Value you can check the system time then if the time is within the range you require you send the mail.
If outlook is open all the time(24/7) then you should set a boolean Value to mark that you have sent the mail for that date.
I would assume there may be an onload type function when you open outlook that may also be able to call the SndFirstMail procedure.
I am no expert in coding outlook so i am unsure of how to do this.
I would advise that you should set up a small exeutable (if available) that could perform this task. if you don't have this available you could use access, or Excell and leave these open so it can send the mail.
thanks
David
-
Nov 12th, 2008, 02:15 PM
#7
Re: Automated Daily Email in Microsoft Outlook
If you write code in the VBA editor then it will be easier to automate. If you need this to be distributed to other users then perhaps its best to write a ful AddIn for it.
You may want to check out my Office FAQ (link in signature) for more information.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|