+ Reply to Thread
Results 1 to 7 of 7

Macro Autorun in the open excel file

  1. #1
    Registered User
    Join Date
    09-22-2018
    Location
    POLAND
    MS-Off Ver
    2010
    Posts
    19

    Macro Autorun in the open excel file

    Hi All

    i am looking for code which allow to run continuously every 5 minutes on the file, which is always open.

    What have is:

    Please Login or Register  to view this content.
    What should be added/ changed to make it run all the time, without opening/ closing the file.

    Thx
    Last edited by jeffreybrown; 03-12-2020 at 08:14 AM. Reason: Please use code tags!

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Macro Autorun in the open excel file

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    09-22-2018
    Location
    POLAND
    MS-Off Ver
    2010
    Posts
    19

    Re: Macro Autorun in the open excel file

    Hi

    i just checked your code, but unfortunetly this code not allow to do macro in a loop - continiously, every determine time ( ex. 30 sec )

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Macro Autorun in the open excel file

    Hi again,

    If you add the highlighted line to the code posted previously, you will find that the time is printed to the VBE Immediate Window each time the routine is executed - for testing purposes I used a msTIME_INTERVAL value of "00:00:02" to have the time printed every two seconds until the StopProcess routine is executed manually.

    Please Login or Register  to view this content.
    Hope this helps,

    Greg M

  5. #5
    Registered User
    Join Date
    09-22-2018
    Location
    POLAND
    MS-Off Ver
    2010
    Posts
    19

    Re: Macro Autorun in the open excel file

    Hi

    thank You , its working great!

    one question, this will run all time or it will be stopped after "x" times?

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,516

    Re: Macro Autorun in the open excel file

    Hi again,

    The process will run until either you exit from the Excel application or you manually run the "StopProcess" routine.

    Regards,

    Greg M

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,744

    Re: Macro Autorun in the open excel file

    to avoid autoreopening I suggest to add:

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

+ 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. Autorun Macro after 30 seconds when Excel sheet has been opened
    By Hagoa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2016, 07:00 AM
  2. Autorun macro when open a worksheet
    By danaas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2013, 01:13 PM
  3. Run on Open (Autorun?) Macro to check date
    By druid98 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-08-2012, 09:25 AM
  4. [SOLVED] AutoRun Macro on Workbook Open
    By lloydgodin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2012, 01:41 PM
  5. macro prompts immediately to open a file once the Excel file with the macro is opened
    By jhmayor03 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2012, 10:00 AM
  6. Autorun Macro in Excel
    By LT13L in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2009, 02:32 PM
  7. [SOLVED] Autorun a macro on Excel startup
    By R Guzman in forum Excel General
    Replies: 3
    Last Post: 03-18-2006, 10:20 AM

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