set custom property for multiple shapes

G

G-Money

I have multiple selected shapes and I am trying to set a particular
custom property to the same value for all of the shapes. I have
played with the action section a bit. I am having trouble getting the
value from user input. Ideally there would be an input box in the
right-click menu, but a separate dialog would be okay too. However,
if I have to do a separate dialog, I only want it to prompt the user
once.

Any ideas how to put an input box in the right-click menu? Or a good
way to set a custom property for multiple shapes at once?

Thanks.
Garrett
 
F

fakeForGGroups

Hi Garrett,

You're on the right track with the actions section. In Visio 2003 go
to the shape sheets window. Add a new row in the actions section.

In the action column (of the new action row in the action section, got
it?) use the CALLTHIS function to call a macro in your VBA project.
For example, if you're calling a subroutine named 'thing' in the
module 'dothis', you'd set the action to be
=CALLTHIS("dothis.thing"). Note that the subroutine name is in
quotation marks. I tend to include the module name just to be
careful. The VBA help for CALLTHIS is adequate; there are other
optional parameters.

Now, if you do all that to your master shape in a .vss stencil file
and drop that master wherever you need it in your document, each new
copy will have the same right click behavior.

'dothis.thing' can pop forms or do whatever else you might like to
capture user input.

In the menu column of that row, add the text that you'd like to see
when you right click.

If you have to go in later and programmatically add action fields to
shapes you've already dropped in your document, then it's a tedious
programming nightmare, but it's possible.

Let's assume that you know what to do to fiddle with the custom
properties for one shape. You can select multiple shapes (via shift-
or ctlr-click) and then get at them through the selection object. For
example, select multiple objects and then run this macro:

Sub testSelection()
Dim selectionObj As Visio.Selection
Dim shpObj As Visio.shape

Set selectionObj = ActiveWindow.Selection
Debug.Print selectionObj.Count
For Each shpObj In selectionObj
Debug.Print "Shape : " & shpObj.name
Next shpObj

End Sub

It doesn't do anything useful, but it does cycle around a group of
selected shapes.

Hope that helps.

Ed
 
G

G-Money

Okay, I misunderstood how a selection of shapes is handled by a
context menu. Visio only fires the action from the context menu once
and its up to the action to check for a multiple selection. Thanks
Ed.

Does anyone know of a way to put an input box in a menu? I am looking
for something like the font size input box in the toolbar. Is there a
way to create something like that in a context menu?

Thanks.
Garrett
 

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