Stop the Drop Event when automating diagram creation

Started by goldnhue, July 04, 2008, 08:13:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

goldnhue

I have automated drawing a Visio flow diagram by importing from a text/Excel file.  However, I have an EventDrop pop-up dialog on the Master objects that I can't seem to remove when dropping the objects on the page during automation.  This is what I'm doing:

First I try to remove the EventDrop from the Master Stencil objects:
     Set celobj = shpObj.CellsSRC(Visio.visSectionObject, visRowEvent, visEvtCellDrop)
     celobj.FormulaForce = "="     ' The formula that exists here is the "=DOCMD(1312)"

Then I load each master into a variable:
     Set mstActivity = docFlowStencil.Masters.ItemU(zz)

Then I drop them on the page:
     Set shpNew = pg.Drop(mstActivity, x, y)

Lastly, I try to reset the EventDrop on the Master Stencil:
     Set celobj = shpObj.CellsSRC(Visio.visSectionObject, visRowEvent, visEvtCellDrop)
     celobj.FormulaForce = "=DOCMD(1312)" 


The drawing and dropping works great, but the pop-up dialog still appears .. but then after running it several times, it works (i.e., clears the EventDrop)! ...   Then once cleared, I can't seem to reset the EventDrop back on the MASTER Stencil objects (... though I can set them fine on the objects on the drawing page).   Any suggestions? 

Thank you in advance!





Paul Herber

Perhaps not quite so elegant, how about setting a flag when you are in automation mode and then test this flag in the event handler and just exit if the flag is set.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Visio Guy

Automation isn't causing the pop-up, a ShapeSheet formula is.

Look up AlertResponse in the dev help. This is one way to get rid of the pop-ups.

DropMany might also work, but I'm not sure.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

aledlund

If in fact you want to control events firing from places you don't wish to handle, visio already has a mechanism to help. Check out 'visio.application.isinscope" in the help facility.
al