foreach - VBA For each loop for gluedshapes of a shape in Visio -


i trying loop through shapes gluedshapes , iterates once breaks giving "invalid parameter error" on me.application.activepage.shapes(i).gluedshapes(visgluedshapesall2d, "") during second iteration. surely if runs correctly on first iteration should run correctly on second , third etc...

in code running through shapes looking specific type, iterate through gluedshapes array , check if it's id equal id returned per array element.

the code follows:

 = 1 me.application.activepage.shapes.count         if instr(me.application.activepage.shapes(i).name, "flow connector") > 0             each j in me.application.activepage.shapes(i).gluedshapes(visgluedshapesall2d, "")                 if s.id = j                 end if             next j         end if     next 

thanks, appreciated.

there no need loop through shapes use

 dim s shape  dim id variant   set s = application.activewindow.page.shapes.itemfromid(selection.primaryitem.id)   id = s.gluedshapes(visgluedshapesall1d, "")(0) 

where s current shape , above gives me id of first shape current shape glued shape can connected 1 parent shape.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -