Hmm, I expected the macro to work on any current selection (like in all my Word macros)....
Interesting comment. I don't code that much in Word myself, so that I did not realize that other applications do it better than Visio.
That would however explain why this same question is asked over and over again in the forum.
The trick is to replace the
Application.ActiveWindow.Page.Shapes.ItemFromID(92)
by
ActiveWindow.Selection (1)
This is the shortest form that you can use.
Safer versions would check if at least one shape is selected
if ActiveWindow.Selection.count>0 then
'your code here
end if
If your code is meant to handle only one shape then:
If ActiveWindow.Selection.Count > 1 Then
MsgBox "Please select only one shape."
Else
'your code here
End If
Your code may as well be capable of handling several shapes at once, then:
For Each shp In ActiveWindow.Selection
'your code here
Next shp
@Jumpy, sorry for the inteference. I'm not only bored in the holliday time, but also wanted to set up a "re-usable" answer to this question. Entschuldigung.