+ Reply to Thread
Results 1 to 10 of 10

Can I programmatically simulate clicking the 'stop macro' button in the VBE?

  1. #1
    Alan
    Guest

    Can I programmatically simulate clicking the 'stop macro' button in the VBE?


    Can I simulate the clicking of the stop button in the VB Editor using
    VBA?

    Thanks,

    Alan.



  2. #2
    Nate Oliver
    Guest

    RE: Can I programmatically simulate clicking the 'stop macro' button i

    Hello,

    For effect, you could use the The End Statement. See:

    http://msdn.microsoft.com/en-us/vben...l/vastmEnd.asp

    It's use is typically frowned upon.

    Regards,
    Nate Oliver

  3. #3
    Nate Oliver
    Guest

    RE: Can I programmatically simulate clicking the 'stop macro' butt

    Sorry, bad link, try:

    http://msdn.microsoft.com/library/en...l/vastmEnd.asp

  4. #4
    Tom Ogilvy
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    I have never used the stop button, but if you want to just stop code
    execution, use Ctrl + C, Esc, or Break key.

    --
    Regards,
    Tom Ogilvy

    "Alan" <[email protected]> wrote in message
    news:%[email protected]...
    >
    > Can I simulate the clicking of the stop button in the VB Editor using
    > VBA?
    >
    > Thanks,
    >
    > Alan.
    >
    >




  5. #5
    Michel Pierron
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    Hi Alan;
    You can try:

    DoEvents
    Application.VBE.CommandBars.FindControl(ID:=228).Execute

    MP

    "Alan" <[email protected]> a écrit dans le message de
    news:%[email protected]...
    >
    > Can I simulate the clicking of the stop button in the VB Editor using
    > VBA?
    >
    > Thanks,
    >
    > Alan.
    >
    >



  6. #6
    Tom Ogilvy
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    Sorry, misread your post. (I actually couldn't find a stop button, but
    Michael interpreted it as the Reset button). What are you trying to
    achieve.

    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > I have never used the stop button, but if you want to just stop code
    > execution, use Ctrl + C, Esc, or Break key.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Alan" <[email protected]> wrote in message
    > news:%[email protected]...
    > >
    > > Can I simulate the clicking of the stop button in the VB Editor using
    > > VBA?
    > >
    > > Thanks,
    > >
    > > Alan.
    > >
    > >

    >
    >




  7. #7
    Tom Ogilvy
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    For me, I needed to put the DoEvents after the Execute command.

    --
    Regards,
    Tom Ogilvy


    "Michel Pierron" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Alan;
    > You can try:
    >
    > DoEvents
    > Application.VBE.CommandBars.FindControl(ID:=228).Execute
    >
    > MP
    >
    > "Alan" <[email protected]> a écrit dans le message de
    > news:%[email protected]...
    > >
    > > Can I simulate the clicking of the stop button in the VB Editor using
    > > VBA?
    > >
    > > Thanks,
    > >
    > > Alan.
    > >
    > >

    >




  8. #8
    Michel Pierron
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    Yes Tom, you are right.
    MP

    "Tom Ogilvy" <[email protected]> a écrit dans le message de
    news:[email protected]...
    > For me, I needed to put the DoEvents after the Execute command.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Michel Pierron" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi Alan;
    > > You can try:
    > >
    > > DoEvents
    > > Application.VBE.CommandBars.FindControl(ID:=228).Execute
    > >
    > > MP
    > >
    > > "Alan" <[email protected]> a écrit dans le message de
    > > news:%[email protected]...
    > > >
    > > > Can I simulate the clicking of the stop button in the VB Editor using
    > > > VBA?
    > > >
    > > > Thanks,
    > > >
    > > > Alan.
    > > >
    > > >

    > >

    >
    >



  9. #9
    Alan
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Sorry, misread your post. (I actually couldn't find a stop button,
    > but Michael interpreted it as the Reset button). What are you
    > trying to achieve.
    >


    Hi Tom,

    I have a spreadsheet with some event driven code (worksheet change
    event specifically). This is also a shared workbook.

    Occasionally, a user gets a 'Document Not Saved' message when they try
    to save. I believe that this is being caused by an event driven code
    somehow hanging or getting into some kind of loop, stopping the user
    saving.

    We are reviewing the code, but in the meantime, I wanted to give the
    users a way to effectively click on 'reset' in the VBE (without having
    to know anything about the VBE), to stop / reset any runnning code,
    and effect a save.

    I have used the line supplied by Michel
    (news:[email protected]...) amended to include a
    'Do Events' after it as you suggested in reply to that posting, so I
    will see if that gets the users saving again next time it occurs.

    Thanks,

    Alan.




  10. #10
    Alan
    Guest

    Re: Can I programmatically simulate clicking the 'stop macro' button in the VBE?

    "Michel Pierron" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Yes Tom, you are right.
    > MP
    >
    > "Tom Ogilvy" <[email protected]> a écrit dans le message de
    > news:[email protected]...
    >> For me, I needed to put the DoEvents after the Execute command.
    >>
    >> --
    >> Regards,
    >> Tom Ogilvy
    >>
    >>
    >> "Michel Pierron" <[email protected]> wrote in message
    >> news:[email protected]...
    >>> Hi Alan;
    >>> You can try:
    >>>
    >>> DoEvents
    >>> Application.VBE.CommandBars.FindControl(ID:=228).Execute
    >>>
    >>> MP
    >>>


    Hi Michel,

    That looks to be exactly what I need.

    Thank you very much.

    Regards,

    Alan.





+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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