+ Reply to Thread
Results 1 to 7 of 7

Run/Stop macro using toggle button

  1. #1
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Run/Stop macro using toggle button

    Hello all,

    I'm trying to run macro every x seconds when the Toggle Button is pressed in. When it's unpressed the macro should stop running. But unfortunately when you unpres the button the macro keeps running. This is what i have come up with so far:

    Button code:
    Please Login or Register  to view this content.
    Macro:

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Run/Stop macro using toggle button

    https://msdn.microsoft.com/en-us/library/0wt87xba.aspx
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: Run/Stop macro using toggle button

    Apologies but this does not solve the problem. I'm aiming to cancel a scheduled on time event.

  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: Run/Stop macro using toggle button

    Hello ChipsSlave,

    You need to check the state of the Toggle Button before you call startSaveTimer.

    Here is the amended code. Change the name of the worksheet your Toggle Button is on if it is not Sheet1.

    Please Login or Register  to view this content.
    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!)

  5. #5
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: Run/Stop macro using toggle button

    What if the button is placed in a user form called "menu"? I have tried to replace "Worksheets("Sheet1").OLEObjects("To..." into "menu.OLEObjects("To..." but it doesnt work. Any ideas?

  6. #6
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: Run/Stop macro using toggle button

    Never mind sorted. Thank you.

    Please Login or Register  to view this content.

  7. #7
    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: Run/Stop macro using toggle button

    Hello ChipsSlave,

    Glad you got that sorted out. It is more rewarding when you can figure it out on your own.

+ 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: 1
    Last Post: 02-13-2014, 10:55 PM
  2. Toggle Button VBA Handler macro
    By re0 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2013, 07:51 PM
  3. Need Toggle button to stop working once data entered into a specific cell
    By kwebbers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2013, 03:34 PM
  4. [SOLVED] Toggle Button, Macro Off/On Help
    By ike609 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2012, 09:27 AM
  5. Toggle Button to Start/Stop Scrollbar Progression
    By JP777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2012, 12:46 AM
  6. [SOLVED] macro to copy toggle button & behaviour
    By connieb in forum Excel General
    Replies: 2
    Last Post: 07-03-2011, 04:14 AM
  7. Toggle Macro on Button
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-05-2010, 01:08 PM
  8. Macro in a Toggle Button
    By Preatorian in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2009, 09: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