vba - How to assign a hyperlink and an onaction event to a shapes object in Excel -
in microsoft excel vba, attempting assign hyperlinks and/or actions shapes have drawn. here have tried (uncomment 1 line @ time)
basically, want allow users more information clicking on shape object. hyperlinks fine, kind of event handler accepts parameters ideal. creating hundreds of these shapes, , need link unique places in document.
dim destinationhyperlinkcell range set destinationhyperlinkcell = range("10:10") ' (do stuff here)... sheet1.shapes.addtextbox(msotextorientationhorizontal, _ 600, _ 600, _ 300, _ 16) .textframe.characters.text = "test thing" .name = destinationhyperlinkcell.address & " group of shapes" '.hyperlink.address = destinationhyperlinkcell.address '.hyperlink.range = destinationhyperlinkcell.address '.onaction = "'showdebugmsg """ & .name & """'" end
use "assign macro ..." define macro each shape fires on "click"
you can use same macro each shape , use application.caller property name of shape fired macro. have ingredients write intelligent handler - (hidden) excel table resolves shape name url, text or whatever
sub shape_click() msgbox "co-cooo! from" & application.caller end sub hope helps
good luck - miked
Comments
Post a Comment