• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Today() to send email vs outlook

Excelnoub

Member
Can this be done even if the Excel spreadsheet is closed?

First off, this code is unfinished but functional when you hit the macro...


Sub Mail_small_Text_Outlook()

'Working in Office 2000-2010

Dim OutApp As Object

Dim OutMail As Object

Dim strbody As String


Set OutApp = CreateObject("Outlook.Application")

Set OutMail = OutApp.CreateItem(0)


strbody = "Project number "" will expire today at 02:00PM"


On Error Resume Next

With OutMail

.To = "insert your email"

.cc = ""

.BCC = ""

.Subject = "Project number """

.Body = strbody

.Send 'or use .Display

End With

On Error GoTo 0


Set OutMail = Nothing

Set OutApp = Nothing


End Sub


I need the following but i'm not to sure it is possible... based on previous views of multi forums...


I need the strbody = "Project number "" will expire today at 02:00PM" the "" to look for the information in my column C vs my Column A to add the information.


Column C = Dates

Column A = Text


If column C = Date (today) then send email with the following strbody: Project number Text will expire today at 02:00PM.


Example: User adds 2012/07/12 in column C <---- then it will send an email with the right info.

User adds 2012/07/16 <---- Then it will only send on that date.


Is this possible?


Can outlook be able to send an email if excel is closed or does the worksheet needs to be open?
 
Another example:


Row 1:

Cell A1 = Test1

Cell C1 = 2012/07/12


Row 2:

Cell A2 = Test2

Cell C2 = 2012/07/13


The following will be sent:

______________________________________________

Subject: Project number Test1

strbody: Project number Test1 will expire today at 02:00P

______________________________________________


Row 2:

Cell A2 = Test2

Cell C2 = 2012/07/13 will be sent the day after as the date is not Today()


Can this be done?
 
Hi, Excelnoub!


A macro in Excel is run either manually (Alt-F8, Macros, Execute, or clicking on a control -button, shape- which has it assigned) or event driven (worksheet selection change, worksheet change, workbook auto open, or responding to clicks on controls), but in all cases and despite of what macro does its container file should be open. Otherwise you won't be able to run it.


Regards!
 
Hi JB-007,

To run the Code, we can use.. Window Scheduler, to open a Workbook, and in Workbook_Open() we can assign the Macro,

or in Outlook Express with Alert or Rules or Directly

Code:
Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"


Hope now it works..
 
@Debraj Roy

Hi!

I haven't tried it before, but it might be worth giving it a try. Could you?

BTW, Excel should be running (either manually or automatically) and the workbook open (same considerations).

Regards!

PS: I answered assuming you rebaptized me... or it was a typo error?
 
Back
Top