Preventing insert of new page

A

Andy

Anyone know of a way to prevent the insert of a new page as I only want
my user to create new pages via my application (from vba) to control
the page naming and create various user properties etc. I only seem to
be able to get an event after a page has been inserted and the new page
dialog has appeared. I could delete the page after its been added if
this has not been created by my application, but not a very nice
solution.

It would be nice if visio had before events for lots of these types of
commands.

Thanks
 
P

Paul Herber

Anyone know of a way to prevent the insert of a new page as I only want
my user to create new pages via my application (from vba) to control
the page naming and create various user properties etc. I only seem to
be able to get an event after a page has been inserted and the new page
dialog has appeared. I could delete the page after its been added if
this has not been created by my application, but not a very nice
solution.

You need to disable the insert page menus. Look for some example code
to modify Visio menus.

iterate through all the emenus
if the menu.menu_command = visCmdOptionsNewPage then
menu.disable
endif
end
 
C

Chris [Visio MVP]

UI sample code will be found under Visio's UIObject. It's a bit weird to
work with, so be sure to check the samples.

You might want to double-check that there are no right-mouse menu items
(like on the page tabs) or keyboard shortcuts for inserting pages as well.


--
Hope this helps,

Chris Roth
Visio MVP
 
A

Andy

Thanks for all the information.

My solution was to find the menu items for insert page etc and assign
the command bar buttons for these to a class using the withevents for
the CommandBarButtons. I was then able to catch these commands, cancel
the default action and popup my own dialogs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top