+ Reply to Thread
Results 1 to 5 of 5

How to send the email if the date range is changing

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    How to send the email if the date range is changing

    Hi All,

    I am new to the VBA , I am working on a project to send mail.

    Here is the my code:
    Please Login or Register  to view this content.
    So when I am refreshing my D:\VBA Testing\xyz.xlsm file some times date range is not changing as the data is not updated in data base.

    So I have to stop sending the email if the data base is not updated.

    I automated this by scheduling on task scheduler in windows by writing auto run option after opening work book.

    I provided Start date in cell value A3 and end date is in A4 in sheet 1.

    After refreshing if end date value in A4 doesn't change or end date value is not equal to current date - 1 then I have to exit from macro
    Last edited by Leith Ross; 03-07-2013 at 02:15 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to send the email if the date range is changing

    Hello anikethkulkarni@gmai
    ,

    Welcome to the Forum!

    You didn't mention how this date changes. Are you using the formula "=Now()" or something else to obtain this date?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-07-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to send the email if the date range is changing

    Hi Leith ,

    Thanks for quick reply. The date changes after refreshing the pivot table. I used =TEXT(MAX(A8:A500), "DD-MM-YYYY") formula to display the date in A4 cell.

    So if this value is < current date - 1 then the macro has to be exit as the data is not updated in data base.

    You can download the my example file from following link

    http://dl.dropbox.com/u/99922185/Sample_test.xls

    Please help me.

    In the attached file first i will refresh the raw data then pivot also refresh automatically . now if A4 value is current date - 1 i have to send the mail by saving it to .xls file in another location. or else i have to exit the macro.

    Thanks again .

    Aniketh Kulkarni

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to send the email if the date range is changing

    Hello Aniketh,

    Seems like we are experiencing heavy server loads. I wasn't able to reconnect till now. To ensure the worksheet calculations occur, copy and paste the macro code below into your ThisWorkbook module.
    Please Login or Register  to view this content.
    This will cause each sheet to calculate when the workbook is first opened.

  5. #5
    Registered User
    Join Date
    03-07-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to send the email if the date range is changing

    Hi Leith ,

    Sorry to disturb you again and again i think there is a misunderstanding b/w us.

    The above code is not working.

    Following steps i have to do

    1. Refresh the data by using macro ( i am using Activeworkbook.Refresh all)
    2. Convert the report to Xls format and send that report as e mail
    3. If the report is blank exit macro
    4. If the report is not updated ( data is not changed ) then also exit macro.

    Your help is much needed on this.

    Thanks

    Aniketh Kulkarni

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1