question

WenyingZhu-0233 avatar image
0 Votes"
WenyingZhu-0233 asked erinding-msft commented

"Can't execute code in break mode" pops out everytime opening the new word file

Hello,
I am using Office 365 subscribed by the company. I forgot to close the "Visual Basic" tab once I closed the Word file. After that, a "Can't execute code in break mode" pops out every time when I open a new word file. I have attached the screenshot for the message I got. The first two lines were highlighted. It seems like there are some issues about these two code.


Private Sub m_app_WindowActivate(ByVal doc As Word.Document, ByVal wn As Word.Window)
If IsProtectedViewWindow Then Exit Sub

If m_app Is Nothing Or wt Is Nothing Then
initGlobals
End If
Call wt.WindowActivated(doc)
Call checkDocUserName
End Sub

I tried to uninstall the Office 365 and install it again. Unfortunately, the problem was not fixed.
Could you help me to figure out the solution for this issue?
Thank you!

office-vba-devoffice-word-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

erinding-msft avatar image
0 Votes"
erinding-msft answered erinding-msft commented

@WenyingZhu-0233

The error generally occurs when you tried to run code from the Macro dialog box but Visual Basic was already running code, although the code was suspended in break mode.
Based on your description, this maybe relate to "forgot to close the "Visual Basic" tab once I closed the Word file".

Please try to press the Break button in the Visual Basic Editor to check this issue.
62733-image.png

More information about this error, you could refer to "Can't execute code in break mode".

Besides, tag "office-word-itpro" focuses on general issues about Word clients.
If you would like to check if there is something wrong with your code and whether the code caused the error, it is suggested to add a tag "office-vba-dev".


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (12.5 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you!

0 Votes 0 ·

You're welcome~

0 Votes 0 ·