A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Monthly E-Mails



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 12th 08, 02:29 AM posted to microsoft.public.outlook.program_vba
JP[_3_]
external usenet poster
 
Posts: 201
Default Monthly E-Mails

Now you got it. Congrats!

--JP

On Mar 11, 7:16*pm, Gabe wrote:
I think I answered my own question, I just had to put in a case statement in.
Here is the final. Thanks again.

Sub MyFunction()
* * Dim olApp As Outlook.Application
* * Dim olMsg As Outlook.MailItem
* * Dim MyMonth
* * MyMonth = Month(Date) 'current month
* * Select Case MyMonth
* * * * Case 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12 'if the current month
(MyMonth) equals these months then send this message
* * * * * * Set olApp = Outlook.Application
* * * * * * Set olMsg = olApp.CreateItem(olMailItem)
* * * * * * * * With olMsg
* * * * * * * * .To = "
* * * * * * * * .Subject = "Monthly Report"
* * * * * * * * .Attachments.Add ("C:\test.doc")
* * * * * * * * .Display
* * * * * * * * .BodyFormat = olFormatHTML
* * * * * * * * .HTMLBody = "HTMLHHello,/H2BODYBLOCKQUOTEAttached
is the monthly report./BLOCKQUOTE/BODY/HTMLHBODYThanks./HTML" &
.HTMLBody
* * * * * * * * End With
* * * * * * Set olMsg = Nothing
* * * * * * Set olApp = Nothing
* * End Select
* * Select Case MyMonth
* * * * Case 3, 4 'if the current month (MyMonth) equals these months then
send this message
* * * * * * Set olApp = Outlook.Application
* * * * * * Set olMsg = olApp.CreateItem(olMailItem)
* * * * * * * * With olMsg
* * * * * * * * .To = "
* * * * * * * * .Subject = "Monthly Report"
* * * * * * * * .Attachments.Add ("C:\test.doc")
* * * * * * * * .Display
* * * * * * * * .BodyFormat = olFormatHTML
* * * * * * * * .HTMLBody = "HTMLHHello,/H2BODYBLOCKQUOTEAttached
is the monthly report./BLOCKQUOTE/BODY/HTMLHBODYThanks./HTML" &
.HTMLBody
* * * * * * * * End With
* * * * * * Set olMsg = Nothing
* * * * * * Set olApp = Nothing
* * End Select
End Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar - Monthly alleycat Outlook - General Queries 1 September 25th 07 08:54 PM
monthly calendar alleycat Outlook - General Queries 0 September 24th 07 10:22 PM
monthly calendar alleycat Outlook - General Queries 0 September 24th 07 10:00 PM
monthly calendar alleycat Outlook - General Queries 1 September 24th 07 03:50 AM
Can's able to recieve mails but sending mails About Outlook Configuration Outlook - General Queries 4 July 5th 06 06:00 PM


All times are GMT +1. The time now is 03:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.