+ Reply to Thread
Results 1 to 3 of 3

Breakpoint will not stop Excel subroutine

  1. #1
    Registered User
    Join Date
    08-23-2005
    Posts
    1

    Question Breakpoint will not stop Excel subroutine

    I have a routine (CreateTextFile) that accepts a type variable, and saves the selected cells as a csv or tab file, giving a message box at the end "file xxx saved".

    I have attached it to a toolbar button, with the assigned macro as 'CreateTextFile("tab")".

    When I click the button, the macro runs twice - it displays the msgbox twice.

    So it inserted a breakpoint, and the code doesn't stop, it just runs twice anyway.

    I found an entry in this forum - "Breakpoint will not stop Excel function" posted "03-08-2004, 03:50 PM", but the question of why the breakpiont gets ignored was not answered.

    Does anyone have any ideas why a breakpoint will be ignored?

    This routine is definately being run by pressing the button, and if I call it from another short subroutine and pass it "tab" or "csv" it runs only once, and breakpoints or single stepping work fine.

    Thanks,

    boswald

  2. #2
    Bob Phillips
    Guest

    Re: Breakpoint will not stop Excel subroutine

    The only thing that I can think of is that the code exits before the
    breakpoint, or is bypassed by an IF or a GOTO.

    What does the code look like.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "boswald" <boswald.1u8mea_1124834705.2648@excelforum-nospam.com> wrote in
    message news:boswald.1u8mea_1124834705.2648@excelforum-nospam.com...
    >
    > I have a routine (CreateTextFile) that accepts a type variable, and
    > saves the selected cells as a csv or tab file, giving a message box at
    > the end "file xxx saved".
    >
    > I have attached it to a toolbar button, with the assigned macro as
    > 'CreateTextFile("tab")".
    >
    > When I click the button, the macro runs twice - it displays the msgbox
    > twice.
    >
    > So it inserted a breakpoint, and the code doesn't stop, it just runs
    > twice anyway.
    >
    > I found an entry in this forum - "Breakpoint will not stop Excel
    > function" posted "03-08-2004, 03:50 PM", but the question of why the
    > breakpiont gets ignored was not answered.
    >
    > Does anyone have any ideas why a breakpoint will be ignored?
    >
    > This routine is definately being run by pressing the button, and if I
    > call it from another short subroutine and pass it "tab" or "csv" it
    > runs only once, and breakpoints or single stepping work fine.
    >
    > Thanks,
    >
    > boswald
    >
    >
    > --
    > boswald
    > ------------------------------------------------------------------------
    > boswald's Profile:

    http://www.excelforum.com/member.php...o&userid=26566
    > View this thread: http://www.excelforum.com/showthread...hreadid=398407
    >




  3. #3
    Tushar Mehta
    Guest

    Re: Breakpoint will not stop Excel subroutine

    If you are using the syntax =CreateTextFile("tab") for a button's
    OnAction setting, for some reason XL runs the code twice. See a
    concurrent discussion in .office.developer.vba titled "OnAction setting
    for menu item" including how I would code the statement.

    As far as the breakpoint bit goes, put a breakpoint at the very *first*
    line of code in the routine -- or if necessary use the Stop statement.
    Then, step through the code with F8 and check what happens.

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <boswald.1u8mea_1124834705.2648@excelforum-nospam.com>,
    boswald.1u8mea_1124834705.2648@excelforum-nospam.com says...
    >
    > I have a routine (CreateTextFile) that accepts a type variable, and
    > saves the selected cells as a csv or tab file, giving a message box at
    > the end "file xxx saved".
    >
    > I have attached it to a toolbar button, with the assigned macro as
    > 'CreateTextFile("tab")".
    >
    > When I click the button, the macro runs twice - it displays the msgbox
    > twice.
    >
    > So it inserted a breakpoint, and the code doesn't stop, it just runs
    > twice anyway.
    >
    > I found an entry in this forum - "Breakpoint will not stop Excel
    > function" posted "03-08-2004, 03:50 PM", but the question of why the
    > breakpiont gets ignored was not answered.
    >
    > Does anyone have any ideas why a breakpoint will be ignored?
    >
    > This routine is definately being run by pressing the button, and if I
    > call it from another short subroutine and pass it "tab" or "csv" it
    > runs only once, and breakpoints or single stepping work fine.
    >
    > Thanks,
    >
    > boswald
    >
    >
    > --
    > boswald
    > ------------------------------------------------------------------------
    > boswald's Profile: http://www.excelforum.com/member.php...o&userid=26566
    > View this thread: http://www.excelforum.com/showthread...hreadid=398407
    >
    >


+ 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