Search code examples
vbashapesvisio

Suppress or close automatic dialogue boxes when dropping shapes (specifically off-page reference) visio vba


I am programatically adding pages and adding references to those pages on the main title page of a document. This all works fine; however, after the macro finishes many dialogue boxes pop up asking whether I want to create a new page and drop a linked Off-page ref to that page. I am setting links, names, etc. programatically.

I have tried to set the application.AlertResponse = 2 (where 2 is IDCANCEL) to cancel the boxes as they pop up with no luck and haven't been able to find anything related to this issue online. Anyone have any input for me?


Solution

    1. If you set Application.AlertResponse = 2 at the very beginning of your code, that should work, I believe.

    2. Note that the off-page connector shape is designed to work the way it does, and in most scenarios it makes sense. You could be able to disable the dialogs by creating your own version of the off-page connector shape (e.g. by creating a copy of the default one and editing it so that it does not show that dialog). The default one shows the dialog using the "Event Drop" shape sheet cell. So if you clear that cell in your version of the off-page connector, no dialog will be shown when you drop your version.