I need a break

I was programming Visio almost from the beginning. At the time it was in C. Around version 3, Visio was the first non MS product to fully implement VBA, including the macro recorder. When VBA was introduced, I was hooked. I could quickly automate Visio.

Well almost, they did not trap the Break key. You can easily trap the break key in Excel.

So what is the big deal? You could always use the Task Manager to kill the Visio process. The problem is that you can not log information to figure out where the endless loop occurs. You could throw in Debug.Print statements to write information to the Immediate window, but that is lost when the task is killed.

Debug.Print has its’ limitations. As with most logging system, there is a limit to the number of lines saved, beyond that point, old lines are lost. I prefer to Write the Output to a text file. With a run away process, the text file can be hundreds of pages long

TxtFileName = CurDir() & “\” & “CreateShapes.doc”
Open TxtFileName For Output Shared As #1
startingTime = Now(): InterimTime = Now()
Print #1, “startingTime = “; startingTime

Excel has the ability to controls how Microsoft Excel handles Ctrl+Break (or Esc or Command+Period) user interruptions to the running procedure. 

https://docs.microsoft.com/en-us/office/vba/api/excel.application.enablecancelkey

Visio does not have that feature, but after a little playing I found a key combo that was supported.

Ctrl + Alt + Break.

I did not need all the fancy support Excel had, I just needed a way to interrupt Visio and not lose my session.

I hope you find this useful.

John… Visio MVP in x-aisle
JohnVisioMVP.ca

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993