Can't enter break mode at this time

后端 未结 4 1055
花落未央
花落未央 2021-01-15 03:04

This has been happening increasingly, when I have a sheets.add or sheets.delete in excel VBA. After searching and searching I finally found the official Microsoft support pa

4条回答
  •  时光取名叫无心
    2021-01-15 03:10

    Here are a few suggestions which are not fool-proof,

    Firstly, verify that the error does not occur if a breakpoint is not set.

    If it doesn't, try a few other things:

    1. From the VBE Debug menu, "Compile VBA Project", it's worth a shot.
    2. Delete the line entirely. Run the code. Then put the line back in and try again with the breakpoint.
    3. Add a DoEvents statement after the Sheets.Add
    4. Use a MsgBox instead of a breakpoint on a Debug.Print. With the message box displayed, attempt to manually break using ctrl+fn+End. (At this point, "breaking" isn't necessary but it would be interesting to see whether you can break this way)
    5. Put a breakpoint on Sheets.Add instead; practically speaking, there's no reason to put the breakpoint on a Print statement if you can just put it on the preceding line.
    6. Are there any Addins? If so, disable all of them and re-enable one at a time, testing to see which one may contribute to the error.

提交回复
热议问题