+ Reply to Thread
Results 1 to 6 of 6

Run macro after date

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Run macro after date

    Hello

    I have code to delete the excel file
    but i want code it date after 10/10/2019 then my code will run

    also can i get the date from popular websites like time.is ? to avoid user change system date?

    Thanks

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,938

    Re: Run macro after date

    So what is your current code?

    To get time from some site, you can use free API's that's out there.

    Ex: Using WorldTimeApi...
    Please Login or Register  to view this content.
    This will return response in json format. You can use text manipulation/pattern matching etc to extract the info you need.
    EDIT: FYI - qStr is the time zone. By adding .txt at end of timezone string, you can obtain response in plain text. Which may be easier to parse in VBA.

    Link to API documentation for url used in above.
    http://worldtimeapi.org/
    Last edited by CK76; 09-04-2019 at 09:52 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,938

    Re: Run macro after date

    Here's sample that checks if current date matches some date.

    Note that you should change qStr to your local timezone (or user's). And adjust DateSerial as well.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Run macro after date

    Thanks i will test it now, but in this point

    If CDate(Left(x, 10)) = DateSerial(2019, 9, 4) Then

    i want if date move after 10/10/2019 Then... i will paste my code

    i think its now if its = 4/9/2019

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,938

    Re: Run macro after date

    Like I stated. Change DateSerial(2019, 9, 4) to what ever the date you need it to be.

    Or use cell value if you want.

  6. #6
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Run macro after date

    Thanks work

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 07-26-2019, 07:42 PM
  2. Dates Macro. Calculating date based on current date and input date
    By sachin20us in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2018, 09:29 AM
  3. How to write macro to send email when date is matching with current date
    By gunanidhi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2016, 02:16 AM
  4. Macro to find Date Cells > Current Date and delete everything to left of that cell
    By LewisLonsdale in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2015, 06:36 AM
  5. [SOLVED] Macro to match date in data table and copy cell range containing date.
    By 54ed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2014, 04:52 AM
  6. Macro to Change color of cell after cross referencing date with a given date.
    By liajet24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2013, 12:33 PM
  7. create a macro to alert me if today's date is within 5 days of expected delivery date
    By ashmcclure in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 09-25-2008, 05:51 PM

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