Custom Menus

G

genc ymeri

Hello,
I need to create a custom menu with my custom commands. To make it simple
what I'm asking is :

How can I add single "SayHello" command in "MyMenu", which after been
clicked, it will pop up a message saying "Hello".

MyMenu
SayHello

I can do it in Word/Excel and other people I know of in different companies
do it in MSVisio.

Any answer about that ?

thanks in advance
 
A

Al Edlund

Visio although a part of the MS office suite, is neither Word nor Excel.
It's a different platform with some very different strengths and challanges.
Al
 
A

Al Edlund

This from chapter 7 of the book I referenced



When a user right-clicks a shape on the drawing page, a shortcut menu
appears that

includes commands that apply to the selection. You can define commands that

appear on a shape's shortcut menu and on the Actions submenu of the Shape
menu.

A row in a shape's or page's Actions section defines a command name and
action provided

by that shape or page.

For example, you could define an action called Run Program for a shape that
evaluates

this formula when performed:

Action= RUNADDON("my_prog.exe")

When a user right-clicks the shape, "Run Program" appears on the shortcut
menu. If

Run Program is chosen, the Visio® engine evaluates the formula. In this
case, the

my_prog.exe program starts.

Another example would be from chapter 22 on creating a custom menu

Dim uiObj As Visio.UIObject

Dim menuSetsObj As Visio.MenuSets

Dim menuSetObj As Visio.MenuSet

Dim menusObj As Visio.Menus

Dim menuObj As Visio.Menu

Dim menuItemsObj As Visio.MenuItems

Dim menuItemObj As Visio.MenuItem

'Get a UIObject object that

Set uiObj = Visio.Application.

'Get the MenuSets collection

Set menuSetsObj = uiObj.MenuSets

'Get drawing window MenuSet

Set menuSetObj= menuSetsObj.

'Get the Menus collection

Set menusObj = menuSetObj.Menus

'Add a Demo menu before the

'A menu without a menu item

Set menuObj = menusObj.AddAt(

menuObj.Caption = "Demo"
 
G

genc ymeri

I'll give it a try.
Thank you very much Al Edlund.

Aren't you off today ? :) :) :)

regards,
g.y

PS:
I have to make a proto-type for one of our new products so I needed things
initially in rush. Of courser I have orderes books and msdn stuff.....
 
A

Al Edlund

I apologize if I sounded like I wasn't giving you the 'quick' answer. I
understand the frustration of the time it takes to get up to speed on Visio,
but in my experience it is really worth the trip. The tool can be
phenomenally powerful at illustrating some fairly complex environments and
giving the user controls at the object level. This means that some of the
easiser methods used by other office applications may not have a direct
correlary.
Have a great new year,
Al
 
M

Michael J. Hunter

That link is indeed the place to start. Visio supports two different APIs
for customizing its menus and toolbars. The UIObject API is Visio's
original method for UI customizations. UIObject includes concepts such as
menu contexts (i.e., a different menu set and toolbar set appear when the
drawing window is active vs. when the master edit window is active) and
attaching menus and toolbars to specific documents (i.e., when a different
document becomes active the set of menus and toolbars can change).

Starting with Visio 2002, Visio also supports the MSO CommandBar API. This
is the same API the other Office applications support. The CommandBar API
can be simpler to work with than UIObject, but it's not as powerful either
(e.g., no built-in support for per-document UI).


Michael J. Hunter
Microsoft
michhu-at-online-dot-microsoft-dot-com

Developing Microsoft Visio Solutions:
http://msdn.microsoft.com/library/en-us/devref/HTML/DVS_Copyright_1270.asp
Developer Resources for Microsoft Visio:
http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28000456

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
G

genc ymeri

Yeah your and Al Edlund's info was very helpful.

Thanks for support and keep it like that :) :) thnx
 

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