vba - Invalid Use of Property error on Shape.OnAction -


i'm trying put macro shape vba received error "invalid use of property", why?
class ccontainer code:

option explicit sub createcontainer() dim s shape ' shape container dim t shape 'text container dim sr variant 'container grouping dim w worksheet set w = activeworkbook.worksheets(1) set s = w.shapes.addshape(msoshaperectangle, 10, 10, 100, 100) s s.fill.forecolor.rgb = rgb(255, 255, 255) s.line.forecolor.rgb = rgb(100, 100, 100) s.line.dashstyle = msolinedash s.line.style = msolinesingle s.line.weight = 0.5 s.name = "shapeexample" end set t = w.shapes.addtextbox(msotextorientationhorizontal, s.left + 10, s.top + 10, s.width - 20, 20) t t.line.forecolor.rgb = rgb(100, 100, 100) t.line.dashstyle = msolinedash t.textframe.characters.text = "connector" t.textframe.characters.font.size = 10 t.textframe.horizontalalignment = xlhaligncenter t.name = "textshapeexample" end set sr = w.shapes.range(array("shapeexample", "textshapeexample")).group sr.name = "containerexample"  t.onaction "msgcall" '<-- here error occurs end sub  sub msgcall() msgbox "hello there" end sub 

and here's module want call it:

option explicit  sub example() dim connector ccontainer set connector = new ccontainer connector.createcontainer  end sub 

i changed code bit this:

with worksheets(1).shapes(1)  .onaction "msgcall" '<-- no more error here  end 

now, i'm getting different error: grouping disabled selected shapes code:

set sr = w.shapes.range(array("shapeexample", "textshapeexample")).group 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -