Assign a macro at runtime for doubleclick event of a shape

K

Kota

Hi,

I want to assign a macro at runtime in VBA for double click event of a shape.

Please verify this syntex. I got from Visio 2003, but it is not working in
Visio 2002.

Application.ActiveWindow.Page.Shapes.ItemFromID(ShapeCount).CellsSRC(visSectionObject,
visRowEvent, visEvtCellDblClick).FormulaU =
"RUNMACRO(""Interactive_Agent.Module1.Macro2"")"

what may be the wrong in this syntex

I am working on Visio 2002.

Thanks,
Kota.
 
C

Chris Roth [ Visio MVP ]

Quote problems?

Also, you could clean it up:

dim f as string
f = "RUNMACRO('Interactive_Agent.Module1.Macro2')" '...note single
quotes around add-on name
f = replace(f, "'",chr(34)) '...replace single quote with double

shp.CellsU("EventDblClick").Formula = f

Also, check out the ShapeSheet function "CallThis" in the developer's help.

--

Hope this helps,

Chris Roth
Visio MVP
 
D

David Parker [Visio MVP]

Wasn't ItemFromID introduced in Visio 2003?

Application.ActiveWindow.Page.Shapes(ShapeCount) should work instead.
 

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